Skip to main content

google_cloud_talent_v4/
client.rs

1// Copyright 2025 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 Cloud Talent Solution API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_talent_v4::client::CompanyService;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28///    project_id: &str,
29///    tenant_id: &str,
30/// ) -> anyhow::Result<()> {
31///     let client = CompanyService::builder().build().await?;
32///     let mut list = client.list_companies()
33///         .set_parent(format!("projects/{project_id}/tenants/{tenant_id}"))
34///         .by_item();
35///     while let Some(item) = list.next().await.transpose()? {
36///         println!("{:?}", item);
37///     }
38///     Ok(())
39/// }
40/// ```
41///
42/// # Service Description
43///
44/// A service that handles company management, including CRUD and enumeration.
45///
46/// # Configuration
47///
48/// To configure `CompanyService` use the `with_*` methods in the type returned
49/// by [builder()][CompanyService::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://jobs.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::company_service::ClientBuilder::with_endpoint
62/// [with_credentials()]: super::builder::company_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/// `CompanyService` holds a connection pool internally, it is advised to
69/// create one and reuse it. You do not need to wrap `CompanyService` 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 CompanyService {
74    inner: std::sync::Arc<dyn super::stub::dynamic::CompanyService>,
75}
76
77impl CompanyService {
78    /// Returns a builder for [CompanyService].
79    ///
80    /// ```
81    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
82    /// # use google_cloud_talent_v4::client::CompanyService;
83    /// let client = CompanyService::builder().build().await?;
84    /// # Ok(()) }
85    /// ```
86    pub fn builder() -> super::builder::company_service::ClientBuilder {
87        crate::new_client_builder(super::builder::company_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::CompanyService + '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::CompanyService>> {
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::CompanyService> {
120        super::transport::CompanyService::new(conf).await
121    }
122
123    async fn build_with_tracing(
124        conf: gaxi::options::ClientConfig,
125    ) -> crate::ClientBuilderResult<impl super::stub::CompanyService> {
126        Self::build_transport(conf)
127            .await
128            .map(super::tracing::CompanyService::new)
129    }
130
131    /// Creates a new company entity.
132    ///
133    /// # Example
134    /// ```
135    /// # use google_cloud_talent_v4::client::CompanyService;
136    /// use google_cloud_talent_v4::model::Company;
137    /// use google_cloud_talent_v4::Result;
138    /// async fn sample(
139    ///    client: &CompanyService, project_id: &str, tenant_id: &str
140    /// ) -> Result<()> {
141    ///     let response = client.create_company()
142    ///         .set_parent(format!("projects/{project_id}/tenants/{tenant_id}"))
143    ///         .set_company(
144    ///             Company::new()/* set fields */
145    ///         )
146    ///         .send().await?;
147    ///     println!("response {:?}", response);
148    ///     Ok(())
149    /// }
150    /// ```
151    pub fn create_company(&self) -> super::builder::company_service::CreateCompany {
152        super::builder::company_service::CreateCompany::new(self.inner.clone())
153    }
154
155    /// Retrieves specified company.
156    ///
157    /// # Example
158    /// ```
159    /// # use google_cloud_talent_v4::client::CompanyService;
160    /// use google_cloud_talent_v4::Result;
161    /// async fn sample(
162    ///    client: &CompanyService, project_id: &str, tenant_id: &str, company_id: &str
163    /// ) -> Result<()> {
164    ///     let response = client.get_company()
165    ///         .set_name(format!("projects/{project_id}/tenants/{tenant_id}/companies/{company_id}"))
166    ///         .send().await?;
167    ///     println!("response {:?}", response);
168    ///     Ok(())
169    /// }
170    /// ```
171    pub fn get_company(&self) -> super::builder::company_service::GetCompany {
172        super::builder::company_service::GetCompany::new(self.inner.clone())
173    }
174
175    /// Updates specified company.
176    ///
177    /// # Example
178    /// ```
179    /// # use google_cloud_talent_v4::client::CompanyService;
180    /// # extern crate wkt as google_cloud_wkt;
181    /// use google_cloud_wkt::FieldMask;
182    /// use google_cloud_talent_v4::model::Company;
183    /// use google_cloud_talent_v4::Result;
184    /// async fn sample(
185    ///    client: &CompanyService, project_id: &str, tenant_id: &str, company_id: &str
186    /// ) -> Result<()> {
187    ///     let response = client.update_company()
188    ///         .set_company(
189    ///             Company::new().set_name(format!("projects/{project_id}/tenants/{tenant_id}/companies/{company_id}"))/* set fields */
190    ///         )
191    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
192    ///         .send().await?;
193    ///     println!("response {:?}", response);
194    ///     Ok(())
195    /// }
196    /// ```
197    pub fn update_company(&self) -> super::builder::company_service::UpdateCompany {
198        super::builder::company_service::UpdateCompany::new(self.inner.clone())
199    }
200
201    /// Deletes specified company.
202    /// Prerequisite: The company has no jobs associated with it.
203    ///
204    /// # Example
205    /// ```
206    /// # use google_cloud_talent_v4::client::CompanyService;
207    /// use google_cloud_talent_v4::Result;
208    /// async fn sample(
209    ///    client: &CompanyService, project_id: &str, tenant_id: &str, company_id: &str
210    /// ) -> Result<()> {
211    ///     client.delete_company()
212    ///         .set_name(format!("projects/{project_id}/tenants/{tenant_id}/companies/{company_id}"))
213    ///         .send().await?;
214    ///     Ok(())
215    /// }
216    /// ```
217    pub fn delete_company(&self) -> super::builder::company_service::DeleteCompany {
218        super::builder::company_service::DeleteCompany::new(self.inner.clone())
219    }
220
221    /// Lists all companies associated with the project.
222    ///
223    /// # Example
224    /// ```
225    /// # use google_cloud_talent_v4::client::CompanyService;
226    /// use google_cloud_gax::paginator::ItemPaginator as _;
227    /// use google_cloud_talent_v4::Result;
228    /// async fn sample(
229    ///    client: &CompanyService, project_id: &str, tenant_id: &str
230    /// ) -> Result<()> {
231    ///     let mut list = client.list_companies()
232    ///         .set_parent(format!("projects/{project_id}/tenants/{tenant_id}"))
233    ///         .by_item();
234    ///     while let Some(item) = list.next().await.transpose()? {
235    ///         println!("{:?}", item);
236    ///     }
237    ///     Ok(())
238    /// }
239    /// ```
240    pub fn list_companies(&self) -> super::builder::company_service::ListCompanies {
241        super::builder::company_service::ListCompanies::new(self.inner.clone())
242    }
243
244    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
245    ///
246    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
247    ///
248    /// # Example
249    /// ```
250    /// # use google_cloud_talent_v4::client::CompanyService;
251    /// use google_cloud_talent_v4::Result;
252    /// async fn sample(
253    ///    client: &CompanyService
254    /// ) -> Result<()> {
255    ///     let response = client.get_operation()
256    ///         /* set fields */
257    ///         .send().await?;
258    ///     println!("response {:?}", response);
259    ///     Ok(())
260    /// }
261    /// ```
262    pub fn get_operation(&self) -> super::builder::company_service::GetOperation {
263        super::builder::company_service::GetOperation::new(self.inner.clone())
264    }
265}
266
267/// Implements a client for the Cloud Talent Solution API.
268///
269/// # Example
270/// ```
271/// # use google_cloud_talent_v4::client::Completion;
272/// async fn sample(
273/// ) -> anyhow::Result<()> {
274///     let client = Completion::builder().build().await?;
275///     let response = client.complete_query()
276///         /* set fields */
277///         .send().await?;
278///     println!("response {:?}", response);
279///     Ok(())
280/// }
281/// ```
282///
283/// # Service Description
284///
285/// A service handles auto completion.
286///
287/// # Configuration
288///
289/// To configure `Completion` use the `with_*` methods in the type returned
290/// by [builder()][Completion::builder]. The default configuration should
291/// work for most applications. Common configuration changes include
292///
293/// * [with_endpoint()]: by default this client uses the global default endpoint
294///   (`https://jobs.googleapis.com`). Applications using regional
295///   endpoints or running in restricted networks (e.g. a network configured
296///   with [Private Google Access with VPC Service Controls]) may want to
297///   override this default.
298/// * [with_credentials()]: by default this client uses
299///   [Application Default Credentials]. Applications using custom
300///   authentication may need to override this default.
301///
302/// [with_endpoint()]: super::builder::completion::ClientBuilder::with_endpoint
303/// [with_credentials()]: super::builder::completion::ClientBuilder::with_credentials
304/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
305/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
306///
307/// # Pooling and Cloning
308///
309/// `Completion` holds a connection pool internally, it is advised to
310/// create one and reuse it. You do not need to wrap `Completion` in
311/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
312/// already uses an `Arc` internally.
313#[derive(Clone, Debug)]
314pub struct Completion {
315    inner: std::sync::Arc<dyn super::stub::dynamic::Completion>,
316}
317
318impl Completion {
319    /// Returns a builder for [Completion].
320    ///
321    /// ```
322    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
323    /// # use google_cloud_talent_v4::client::Completion;
324    /// let client = Completion::builder().build().await?;
325    /// # Ok(()) }
326    /// ```
327    pub fn builder() -> super::builder::completion::ClientBuilder {
328        crate::new_client_builder(super::builder::completion::client::Factory)
329    }
330
331    /// Creates a new client from the provided stub.
332    ///
333    /// The most common case for calling this function is in tests mocking the
334    /// client's behavior.
335    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
336    where
337        T: super::stub::Completion + 'static,
338    {
339        Self { inner: stub.into() }
340    }
341
342    pub(crate) async fn new(
343        config: gaxi::options::ClientConfig,
344    ) -> crate::ClientBuilderResult<Self> {
345        let inner = Self::build_inner(config).await?;
346        Ok(Self { inner })
347    }
348
349    async fn build_inner(
350        conf: gaxi::options::ClientConfig,
351    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Completion>> {
352        if gaxi::options::tracing_enabled(&conf) {
353            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
354        }
355        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
356    }
357
358    async fn build_transport(
359        conf: gaxi::options::ClientConfig,
360    ) -> crate::ClientBuilderResult<impl super::stub::Completion> {
361        super::transport::Completion::new(conf).await
362    }
363
364    async fn build_with_tracing(
365        conf: gaxi::options::ClientConfig,
366    ) -> crate::ClientBuilderResult<impl super::stub::Completion> {
367        Self::build_transport(conf)
368            .await
369            .map(super::tracing::Completion::new)
370    }
371
372    /// Completes the specified prefix with keyword suggestions.
373    /// Intended for use by a job search auto-complete search box.
374    ///
375    /// # Example
376    /// ```
377    /// # use google_cloud_talent_v4::client::Completion;
378    /// use google_cloud_talent_v4::Result;
379    /// async fn sample(
380    ///    client: &Completion
381    /// ) -> Result<()> {
382    ///     let response = client.complete_query()
383    ///         /* set fields */
384    ///         .send().await?;
385    ///     println!("response {:?}", response);
386    ///     Ok(())
387    /// }
388    /// ```
389    pub fn complete_query(&self) -> super::builder::completion::CompleteQuery {
390        super::builder::completion::CompleteQuery::new(self.inner.clone())
391    }
392
393    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
394    ///
395    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
396    ///
397    /// # Example
398    /// ```
399    /// # use google_cloud_talent_v4::client::Completion;
400    /// use google_cloud_talent_v4::Result;
401    /// async fn sample(
402    ///    client: &Completion
403    /// ) -> Result<()> {
404    ///     let response = client.get_operation()
405    ///         /* set fields */
406    ///         .send().await?;
407    ///     println!("response {:?}", response);
408    ///     Ok(())
409    /// }
410    /// ```
411    pub fn get_operation(&self) -> super::builder::completion::GetOperation {
412        super::builder::completion::GetOperation::new(self.inner.clone())
413    }
414}
415
416/// Implements a client for the Cloud Talent Solution API.
417///
418/// # Example
419/// ```
420/// # use google_cloud_talent_v4::client::EventService;
421/// async fn sample(
422/// ) -> anyhow::Result<()> {
423///     let client = EventService::builder().build().await?;
424///     let response = client.create_client_event()
425///         /* set fields */
426///         .send().await?;
427///     println!("response {:?}", response);
428///     Ok(())
429/// }
430/// ```
431///
432/// # Service Description
433///
434/// A service handles client event report.
435///
436/// # Configuration
437///
438/// To configure `EventService` use the `with_*` methods in the type returned
439/// by [builder()][EventService::builder]. The default configuration should
440/// work for most applications. Common configuration changes include
441///
442/// * [with_endpoint()]: by default this client uses the global default endpoint
443///   (`https://jobs.googleapis.com`). Applications using regional
444///   endpoints or running in restricted networks (e.g. a network configured
445///   with [Private Google Access with VPC Service Controls]) may want to
446///   override this default.
447/// * [with_credentials()]: by default this client uses
448///   [Application Default Credentials]. Applications using custom
449///   authentication may need to override this default.
450///
451/// [with_endpoint()]: super::builder::event_service::ClientBuilder::with_endpoint
452/// [with_credentials()]: super::builder::event_service::ClientBuilder::with_credentials
453/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
454/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
455///
456/// # Pooling and Cloning
457///
458/// `EventService` holds a connection pool internally, it is advised to
459/// create one and reuse it. You do not need to wrap `EventService` in
460/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
461/// already uses an `Arc` internally.
462#[derive(Clone, Debug)]
463pub struct EventService {
464    inner: std::sync::Arc<dyn super::stub::dynamic::EventService>,
465}
466
467impl EventService {
468    /// Returns a builder for [EventService].
469    ///
470    /// ```
471    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
472    /// # use google_cloud_talent_v4::client::EventService;
473    /// let client = EventService::builder().build().await?;
474    /// # Ok(()) }
475    /// ```
476    pub fn builder() -> super::builder::event_service::ClientBuilder {
477        crate::new_client_builder(super::builder::event_service::client::Factory)
478    }
479
480    /// Creates a new client from the provided stub.
481    ///
482    /// The most common case for calling this function is in tests mocking the
483    /// client's behavior.
484    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
485    where
486        T: super::stub::EventService + 'static,
487    {
488        Self { inner: stub.into() }
489    }
490
491    pub(crate) async fn new(
492        config: gaxi::options::ClientConfig,
493    ) -> crate::ClientBuilderResult<Self> {
494        let inner = Self::build_inner(config).await?;
495        Ok(Self { inner })
496    }
497
498    async fn build_inner(
499        conf: gaxi::options::ClientConfig,
500    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EventService>> {
501        if gaxi::options::tracing_enabled(&conf) {
502            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
503        }
504        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
505    }
506
507    async fn build_transport(
508        conf: gaxi::options::ClientConfig,
509    ) -> crate::ClientBuilderResult<impl super::stub::EventService> {
510        super::transport::EventService::new(conf).await
511    }
512
513    async fn build_with_tracing(
514        conf: gaxi::options::ClientConfig,
515    ) -> crate::ClientBuilderResult<impl super::stub::EventService> {
516        Self::build_transport(conf)
517            .await
518            .map(super::tracing::EventService::new)
519    }
520
521    /// Report events issued when end user interacts with customer's application
522    /// that uses Cloud Talent Solution. You may inspect the created events in
523    /// [self service
524    /// tools](https://console.cloud.google.com/talent-solution/overview).
525    /// [Learn
526    /// more](https://cloud.google.com/talent-solution/docs/management-tools)
527    /// about self service tools.
528    ///
529    /// # Example
530    /// ```
531    /// # use google_cloud_talent_v4::client::EventService;
532    /// use google_cloud_talent_v4::Result;
533    /// async fn sample(
534    ///    client: &EventService
535    /// ) -> Result<()> {
536    ///     let response = client.create_client_event()
537    ///         /* set fields */
538    ///         .send().await?;
539    ///     println!("response {:?}", response);
540    ///     Ok(())
541    /// }
542    /// ```
543    pub fn create_client_event(&self) -> super::builder::event_service::CreateClientEvent {
544        super::builder::event_service::CreateClientEvent::new(self.inner.clone())
545    }
546
547    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
548    ///
549    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
550    ///
551    /// # Example
552    /// ```
553    /// # use google_cloud_talent_v4::client::EventService;
554    /// use google_cloud_talent_v4::Result;
555    /// async fn sample(
556    ///    client: &EventService
557    /// ) -> Result<()> {
558    ///     let response = client.get_operation()
559    ///         /* set fields */
560    ///         .send().await?;
561    ///     println!("response {:?}", response);
562    ///     Ok(())
563    /// }
564    /// ```
565    pub fn get_operation(&self) -> super::builder::event_service::GetOperation {
566        super::builder::event_service::GetOperation::new(self.inner.clone())
567    }
568}
569
570/// Implements a client for the Cloud Talent Solution API.
571///
572/// # Example
573/// ```
574/// # use google_cloud_talent_v4::client::JobService;
575/// use google_cloud_gax::paginator::ItemPaginator as _;
576/// async fn sample(
577///    project_id: &str,
578///    tenant_id: &str,
579/// ) -> anyhow::Result<()> {
580///     let client = JobService::builder().build().await?;
581///     let mut list = client.list_jobs()
582///         .set_parent(format!("projects/{project_id}/tenants/{tenant_id}"))
583///         .by_item();
584///     while let Some(item) = list.next().await.transpose()? {
585///         println!("{:?}", item);
586///     }
587///     Ok(())
588/// }
589/// ```
590///
591/// # Service Description
592///
593/// A service handles job management, including job CRUD, enumeration and search.
594///
595/// # Configuration
596///
597/// To configure `JobService` use the `with_*` methods in the type returned
598/// by [builder()][JobService::builder]. The default configuration should
599/// work for most applications. Common configuration changes include
600///
601/// * [with_endpoint()]: by default this client uses the global default endpoint
602///   (`https://jobs.googleapis.com`). Applications using regional
603///   endpoints or running in restricted networks (e.g. a network configured
604///   with [Private Google Access with VPC Service Controls]) may want to
605///   override this default.
606/// * [with_credentials()]: by default this client uses
607///   [Application Default Credentials]. Applications using custom
608///   authentication may need to override this default.
609///
610/// [with_endpoint()]: super::builder::job_service::ClientBuilder::with_endpoint
611/// [with_credentials()]: super::builder::job_service::ClientBuilder::with_credentials
612/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
613/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
614///
615/// # Pooling and Cloning
616///
617/// `JobService` holds a connection pool internally, it is advised to
618/// create one and reuse it. You do not need to wrap `JobService` in
619/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
620/// already uses an `Arc` internally.
621#[derive(Clone, Debug)]
622pub struct JobService {
623    inner: std::sync::Arc<dyn super::stub::dynamic::JobService>,
624}
625
626impl JobService {
627    /// Returns a builder for [JobService].
628    ///
629    /// ```
630    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
631    /// # use google_cloud_talent_v4::client::JobService;
632    /// let client = JobService::builder().build().await?;
633    /// # Ok(()) }
634    /// ```
635    pub fn builder() -> super::builder::job_service::ClientBuilder {
636        crate::new_client_builder(super::builder::job_service::client::Factory)
637    }
638
639    /// Creates a new client from the provided stub.
640    ///
641    /// The most common case for calling this function is in tests mocking the
642    /// client's behavior.
643    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
644    where
645        T: super::stub::JobService + 'static,
646    {
647        Self { inner: stub.into() }
648    }
649
650    pub(crate) async fn new(
651        config: gaxi::options::ClientConfig,
652    ) -> crate::ClientBuilderResult<Self> {
653        let inner = Self::build_inner(config).await?;
654        Ok(Self { inner })
655    }
656
657    async fn build_inner(
658        conf: gaxi::options::ClientConfig,
659    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::JobService>> {
660        if gaxi::options::tracing_enabled(&conf) {
661            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
662        }
663        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
664    }
665
666    async fn build_transport(
667        conf: gaxi::options::ClientConfig,
668    ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
669        super::transport::JobService::new(conf).await
670    }
671
672    async fn build_with_tracing(
673        conf: gaxi::options::ClientConfig,
674    ) -> crate::ClientBuilderResult<impl super::stub::JobService> {
675        Self::build_transport(conf)
676            .await
677            .map(super::tracing::JobService::new)
678    }
679
680    /// Creates a new job.
681    ///
682    /// Typically, the job becomes searchable within 10 seconds, but it may take
683    /// up to 5 minutes.
684    ///
685    /// # Example
686    /// ```
687    /// # use google_cloud_talent_v4::client::JobService;
688    /// use google_cloud_talent_v4::model::Job;
689    /// use google_cloud_talent_v4::Result;
690    /// async fn sample(
691    ///    client: &JobService, project_id: &str, tenant_id: &str
692    /// ) -> Result<()> {
693    ///     let response = client.create_job()
694    ///         .set_parent(format!("projects/{project_id}/tenants/{tenant_id}"))
695    ///         .set_job(
696    ///             Job::new()/* set fields */
697    ///         )
698    ///         .send().await?;
699    ///     println!("response {:?}", response);
700    ///     Ok(())
701    /// }
702    /// ```
703    pub fn create_job(&self) -> super::builder::job_service::CreateJob {
704        super::builder::job_service::CreateJob::new(self.inner.clone())
705    }
706
707    /// Begins executing a batch create jobs operation.
708    ///
709    /// # Long running operations
710    ///
711    /// This method is used to start, and/or poll a [long-running Operation].
712    /// The [Working with long-running operations] chapter in the [user guide]
713    /// covers these operations in detail.
714    ///
715    /// [long-running operation]: https://google.aip.dev/151
716    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
717    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
718    ///
719    /// # Example
720    /// ```
721    /// # use google_cloud_talent_v4::client::JobService;
722    /// use google_cloud_lro::Poller;
723    /// use google_cloud_talent_v4::Result;
724    /// async fn sample(
725    ///    client: &JobService
726    /// ) -> Result<()> {
727    ///     let response = client.batch_create_jobs()
728    ///         /* set fields */
729    ///         .poller().until_done().await?;
730    ///     println!("response {:?}", response);
731    ///     Ok(())
732    /// }
733    /// ```
734    pub fn batch_create_jobs(&self) -> super::builder::job_service::BatchCreateJobs {
735        super::builder::job_service::BatchCreateJobs::new(self.inner.clone())
736    }
737
738    /// Retrieves the specified job, whose status is OPEN or recently EXPIRED
739    /// within the last 90 days.
740    ///
741    /// # Example
742    /// ```
743    /// # use google_cloud_talent_v4::client::JobService;
744    /// use google_cloud_talent_v4::Result;
745    /// async fn sample(
746    ///    client: &JobService, project_id: &str, tenant_id: &str, job_id: &str
747    /// ) -> Result<()> {
748    ///     let response = client.get_job()
749    ///         .set_name(format!("projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}"))
750    ///         .send().await?;
751    ///     println!("response {:?}", response);
752    ///     Ok(())
753    /// }
754    /// ```
755    pub fn get_job(&self) -> super::builder::job_service::GetJob {
756        super::builder::job_service::GetJob::new(self.inner.clone())
757    }
758
759    /// Updates specified job.
760    ///
761    /// Typically, updated contents become visible in search results within 10
762    /// seconds, but it may take up to 5 minutes.
763    ///
764    /// # Example
765    /// ```
766    /// # use google_cloud_talent_v4::client::JobService;
767    /// # extern crate wkt as google_cloud_wkt;
768    /// use google_cloud_wkt::FieldMask;
769    /// use google_cloud_talent_v4::model::Job;
770    /// use google_cloud_talent_v4::Result;
771    /// async fn sample(
772    ///    client: &JobService, project_id: &str, tenant_id: &str, job_id: &str
773    /// ) -> Result<()> {
774    ///     let response = client.update_job()
775    ///         .set_job(
776    ///             Job::new().set_name(format!("projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}"))/* set fields */
777    ///         )
778    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
779    ///         .send().await?;
780    ///     println!("response {:?}", response);
781    ///     Ok(())
782    /// }
783    /// ```
784    pub fn update_job(&self) -> super::builder::job_service::UpdateJob {
785        super::builder::job_service::UpdateJob::new(self.inner.clone())
786    }
787
788    /// Begins executing a batch update jobs operation.
789    ///
790    /// # Long running operations
791    ///
792    /// This method is used to start, and/or poll a [long-running Operation].
793    /// The [Working with long-running operations] chapter in the [user guide]
794    /// covers these operations in detail.
795    ///
796    /// [long-running operation]: https://google.aip.dev/151
797    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
798    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
799    ///
800    /// # Example
801    /// ```
802    /// # use google_cloud_talent_v4::client::JobService;
803    /// use google_cloud_lro::Poller;
804    /// use google_cloud_talent_v4::Result;
805    /// async fn sample(
806    ///    client: &JobService
807    /// ) -> Result<()> {
808    ///     let response = client.batch_update_jobs()
809    ///         /* set fields */
810    ///         .poller().until_done().await?;
811    ///     println!("response {:?}", response);
812    ///     Ok(())
813    /// }
814    /// ```
815    pub fn batch_update_jobs(&self) -> super::builder::job_service::BatchUpdateJobs {
816        super::builder::job_service::BatchUpdateJobs::new(self.inner.clone())
817    }
818
819    /// Deletes the specified job.
820    ///
821    /// Typically, the job becomes unsearchable within 10 seconds, but it may take
822    /// up to 5 minutes.
823    ///
824    /// # Example
825    /// ```
826    /// # use google_cloud_talent_v4::client::JobService;
827    /// use google_cloud_talent_v4::Result;
828    /// async fn sample(
829    ///    client: &JobService, project_id: &str, tenant_id: &str, job_id: &str
830    /// ) -> Result<()> {
831    ///     client.delete_job()
832    ///         .set_name(format!("projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}"))
833    ///         .send().await?;
834    ///     Ok(())
835    /// }
836    /// ```
837    pub fn delete_job(&self) -> super::builder::job_service::DeleteJob {
838        super::builder::job_service::DeleteJob::new(self.inner.clone())
839    }
840
841    /// Begins executing a batch delete jobs operation.
842    ///
843    /// # Long running operations
844    ///
845    /// This method is used to start, and/or poll a [long-running Operation].
846    /// The [Working with long-running operations] chapter in the [user guide]
847    /// covers these operations in detail.
848    ///
849    /// [long-running operation]: https://google.aip.dev/151
850    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
851    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
852    ///
853    /// # Example
854    /// ```
855    /// # use google_cloud_talent_v4::client::JobService;
856    /// use google_cloud_lro::Poller;
857    /// use google_cloud_talent_v4::Result;
858    /// async fn sample(
859    ///    client: &JobService
860    /// ) -> Result<()> {
861    ///     let response = client.batch_delete_jobs()
862    ///         /* set fields */
863    ///         .poller().until_done().await?;
864    ///     println!("response {:?}", response);
865    ///     Ok(())
866    /// }
867    /// ```
868    pub fn batch_delete_jobs(&self) -> super::builder::job_service::BatchDeleteJobs {
869        super::builder::job_service::BatchDeleteJobs::new(self.inner.clone())
870    }
871
872    /// Lists jobs by filter.
873    ///
874    /// # Example
875    /// ```
876    /// # use google_cloud_talent_v4::client::JobService;
877    /// use google_cloud_gax::paginator::ItemPaginator as _;
878    /// use google_cloud_talent_v4::Result;
879    /// async fn sample(
880    ///    client: &JobService, project_id: &str, tenant_id: &str
881    /// ) -> Result<()> {
882    ///     let mut list = client.list_jobs()
883    ///         .set_parent(format!("projects/{project_id}/tenants/{tenant_id}"))
884    ///         .by_item();
885    ///     while let Some(item) = list.next().await.transpose()? {
886    ///         println!("{:?}", item);
887    ///     }
888    ///     Ok(())
889    /// }
890    /// ```
891    pub fn list_jobs(&self) -> super::builder::job_service::ListJobs {
892        super::builder::job_service::ListJobs::new(self.inner.clone())
893    }
894
895    /// Searches for jobs using the provided
896    /// [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest].
897    ///
898    /// This call constrains the
899    /// [visibility][google.cloud.talent.v4.Job.visibility] of jobs present in the
900    /// database, and only returns jobs that the caller has permission to search
901    /// against.
902    ///
903    /// [google.cloud.talent.v4.Job.visibility]: crate::model::Job::visibility
904    /// [google.cloud.talent.v4.SearchJobsRequest]: crate::model::SearchJobsRequest
905    ///
906    /// # Example
907    /// ```
908    /// # use google_cloud_talent_v4::client::JobService;
909    /// use google_cloud_talent_v4::Result;
910    /// async fn sample(
911    ///    client: &JobService
912    /// ) -> Result<()> {
913    ///     let response = client.search_jobs()
914    ///         /* set fields */
915    ///         .send().await?;
916    ///     println!("response {:?}", response);
917    ///     Ok(())
918    /// }
919    /// ```
920    pub fn search_jobs(&self) -> super::builder::job_service::SearchJobs {
921        super::builder::job_service::SearchJobs::new(self.inner.clone())
922    }
923
924    /// Searches for jobs using the provided
925    /// [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest].
926    ///
927    /// This API call is intended for the use case of targeting passive job
928    /// seekers (for example, job seekers who have signed up to receive email
929    /// alerts about potential job opportunities), it has different algorithmic
930    /// adjustments that are designed to specifically target passive job seekers.
931    ///
932    /// This call constrains the
933    /// [visibility][google.cloud.talent.v4.Job.visibility] of jobs present in the
934    /// database, and only returns jobs the caller has permission to search
935    /// against.
936    ///
937    /// [google.cloud.talent.v4.Job.visibility]: crate::model::Job::visibility
938    /// [google.cloud.talent.v4.SearchJobsRequest]: crate::model::SearchJobsRequest
939    ///
940    /// # Example
941    /// ```
942    /// # use google_cloud_talent_v4::client::JobService;
943    /// use google_cloud_talent_v4::Result;
944    /// async fn sample(
945    ///    client: &JobService
946    /// ) -> Result<()> {
947    ///     let response = client.search_jobs_for_alert()
948    ///         /* set fields */
949    ///         .send().await?;
950    ///     println!("response {:?}", response);
951    ///     Ok(())
952    /// }
953    /// ```
954    pub fn search_jobs_for_alert(&self) -> super::builder::job_service::SearchJobsForAlert {
955        super::builder::job_service::SearchJobsForAlert::new(self.inner.clone())
956    }
957
958    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
959    ///
960    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
961    ///
962    /// # Example
963    /// ```
964    /// # use google_cloud_talent_v4::client::JobService;
965    /// use google_cloud_talent_v4::Result;
966    /// async fn sample(
967    ///    client: &JobService
968    /// ) -> Result<()> {
969    ///     let response = client.get_operation()
970    ///         /* set fields */
971    ///         .send().await?;
972    ///     println!("response {:?}", response);
973    ///     Ok(())
974    /// }
975    /// ```
976    pub fn get_operation(&self) -> super::builder::job_service::GetOperation {
977        super::builder::job_service::GetOperation::new(self.inner.clone())
978    }
979}
980
981/// Implements a client for the Cloud Talent Solution API.
982///
983/// # Example
984/// ```
985/// # use google_cloud_talent_v4::client::TenantService;
986/// use google_cloud_gax::paginator::ItemPaginator as _;
987/// async fn sample(
988///    parent: &str,
989/// ) -> anyhow::Result<()> {
990///     let client = TenantService::builder().build().await?;
991///     let mut list = client.list_tenants()
992///         .set_parent(parent)
993///         .by_item();
994///     while let Some(item) = list.next().await.transpose()? {
995///         println!("{:?}", item);
996///     }
997///     Ok(())
998/// }
999/// ```
1000///
1001/// # Service Description
1002///
1003/// A service that handles tenant management, including CRUD and enumeration.
1004///
1005/// # Configuration
1006///
1007/// To configure `TenantService` use the `with_*` methods in the type returned
1008/// by [builder()][TenantService::builder]. The default configuration should
1009/// work for most applications. Common configuration changes include
1010///
1011/// * [with_endpoint()]: by default this client uses the global default endpoint
1012///   (`https://jobs.googleapis.com`). Applications using regional
1013///   endpoints or running in restricted networks (e.g. a network configured
1014///   with [Private Google Access with VPC Service Controls]) may want to
1015///   override this default.
1016/// * [with_credentials()]: by default this client uses
1017///   [Application Default Credentials]. Applications using custom
1018///   authentication may need to override this default.
1019///
1020/// [with_endpoint()]: super::builder::tenant_service::ClientBuilder::with_endpoint
1021/// [with_credentials()]: super::builder::tenant_service::ClientBuilder::with_credentials
1022/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1023/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1024///
1025/// # Pooling and Cloning
1026///
1027/// `TenantService` holds a connection pool internally, it is advised to
1028/// create one and reuse it. You do not need to wrap `TenantService` in
1029/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1030/// already uses an `Arc` internally.
1031#[derive(Clone, Debug)]
1032pub struct TenantService {
1033    inner: std::sync::Arc<dyn super::stub::dynamic::TenantService>,
1034}
1035
1036impl TenantService {
1037    /// Returns a builder for [TenantService].
1038    ///
1039    /// ```
1040    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1041    /// # use google_cloud_talent_v4::client::TenantService;
1042    /// let client = TenantService::builder().build().await?;
1043    /// # Ok(()) }
1044    /// ```
1045    pub fn builder() -> super::builder::tenant_service::ClientBuilder {
1046        crate::new_client_builder(super::builder::tenant_service::client::Factory)
1047    }
1048
1049    /// Creates a new client from the provided stub.
1050    ///
1051    /// The most common case for calling this function is in tests mocking the
1052    /// client's behavior.
1053    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1054    where
1055        T: super::stub::TenantService + 'static,
1056    {
1057        Self { inner: stub.into() }
1058    }
1059
1060    pub(crate) async fn new(
1061        config: gaxi::options::ClientConfig,
1062    ) -> crate::ClientBuilderResult<Self> {
1063        let inner = Self::build_inner(config).await?;
1064        Ok(Self { inner })
1065    }
1066
1067    async fn build_inner(
1068        conf: gaxi::options::ClientConfig,
1069    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TenantService>> {
1070        if gaxi::options::tracing_enabled(&conf) {
1071            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1072        }
1073        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1074    }
1075
1076    async fn build_transport(
1077        conf: gaxi::options::ClientConfig,
1078    ) -> crate::ClientBuilderResult<impl super::stub::TenantService> {
1079        super::transport::TenantService::new(conf).await
1080    }
1081
1082    async fn build_with_tracing(
1083        conf: gaxi::options::ClientConfig,
1084    ) -> crate::ClientBuilderResult<impl super::stub::TenantService> {
1085        Self::build_transport(conf)
1086            .await
1087            .map(super::tracing::TenantService::new)
1088    }
1089
1090    /// Creates a new tenant entity.
1091    ///
1092    /// # Example
1093    /// ```
1094    /// # use google_cloud_talent_v4::client::TenantService;
1095    /// use google_cloud_talent_v4::model::Tenant;
1096    /// use google_cloud_talent_v4::Result;
1097    /// async fn sample(
1098    ///    client: &TenantService, parent: &str
1099    /// ) -> Result<()> {
1100    ///     let response = client.create_tenant()
1101    ///         .set_parent(parent)
1102    ///         .set_tenant(
1103    ///             Tenant::new()/* set fields */
1104    ///         )
1105    ///         .send().await?;
1106    ///     println!("response {:?}", response);
1107    ///     Ok(())
1108    /// }
1109    /// ```
1110    pub fn create_tenant(&self) -> super::builder::tenant_service::CreateTenant {
1111        super::builder::tenant_service::CreateTenant::new(self.inner.clone())
1112    }
1113
1114    /// Retrieves specified tenant.
1115    ///
1116    /// # Example
1117    /// ```
1118    /// # use google_cloud_talent_v4::client::TenantService;
1119    /// use google_cloud_talent_v4::Result;
1120    /// async fn sample(
1121    ///    client: &TenantService, project_id: &str, tenant_id: &str
1122    /// ) -> Result<()> {
1123    ///     let response = client.get_tenant()
1124    ///         .set_name(format!("projects/{project_id}/tenants/{tenant_id}"))
1125    ///         .send().await?;
1126    ///     println!("response {:?}", response);
1127    ///     Ok(())
1128    /// }
1129    /// ```
1130    pub fn get_tenant(&self) -> super::builder::tenant_service::GetTenant {
1131        super::builder::tenant_service::GetTenant::new(self.inner.clone())
1132    }
1133
1134    /// Updates specified tenant.
1135    ///
1136    /// # Example
1137    /// ```
1138    /// # use google_cloud_talent_v4::client::TenantService;
1139    /// # extern crate wkt as google_cloud_wkt;
1140    /// use google_cloud_wkt::FieldMask;
1141    /// use google_cloud_talent_v4::model::Tenant;
1142    /// use google_cloud_talent_v4::Result;
1143    /// async fn sample(
1144    ///    client: &TenantService, project_id: &str, tenant_id: &str
1145    /// ) -> Result<()> {
1146    ///     let response = client.update_tenant()
1147    ///         .set_tenant(
1148    ///             Tenant::new().set_name(format!("projects/{project_id}/tenants/{tenant_id}"))/* set fields */
1149    ///         )
1150    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1151    ///         .send().await?;
1152    ///     println!("response {:?}", response);
1153    ///     Ok(())
1154    /// }
1155    /// ```
1156    pub fn update_tenant(&self) -> super::builder::tenant_service::UpdateTenant {
1157        super::builder::tenant_service::UpdateTenant::new(self.inner.clone())
1158    }
1159
1160    /// Deletes specified tenant.
1161    ///
1162    /// # Example
1163    /// ```
1164    /// # use google_cloud_talent_v4::client::TenantService;
1165    /// use google_cloud_talent_v4::Result;
1166    /// async fn sample(
1167    ///    client: &TenantService, project_id: &str, tenant_id: &str
1168    /// ) -> Result<()> {
1169    ///     client.delete_tenant()
1170    ///         .set_name(format!("projects/{project_id}/tenants/{tenant_id}"))
1171    ///         .send().await?;
1172    ///     Ok(())
1173    /// }
1174    /// ```
1175    pub fn delete_tenant(&self) -> super::builder::tenant_service::DeleteTenant {
1176        super::builder::tenant_service::DeleteTenant::new(self.inner.clone())
1177    }
1178
1179    /// Lists all tenants associated with the project.
1180    ///
1181    /// # Example
1182    /// ```
1183    /// # use google_cloud_talent_v4::client::TenantService;
1184    /// use google_cloud_gax::paginator::ItemPaginator as _;
1185    /// use google_cloud_talent_v4::Result;
1186    /// async fn sample(
1187    ///    client: &TenantService, parent: &str
1188    /// ) -> Result<()> {
1189    ///     let mut list = client.list_tenants()
1190    ///         .set_parent(parent)
1191    ///         .by_item();
1192    ///     while let Some(item) = list.next().await.transpose()? {
1193    ///         println!("{:?}", item);
1194    ///     }
1195    ///     Ok(())
1196    /// }
1197    /// ```
1198    pub fn list_tenants(&self) -> super::builder::tenant_service::ListTenants {
1199        super::builder::tenant_service::ListTenants::new(self.inner.clone())
1200    }
1201
1202    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1203    ///
1204    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1205    ///
1206    /// # Example
1207    /// ```
1208    /// # use google_cloud_talent_v4::client::TenantService;
1209    /// use google_cloud_talent_v4::Result;
1210    /// async fn sample(
1211    ///    client: &TenantService
1212    /// ) -> Result<()> {
1213    ///     let response = client.get_operation()
1214    ///         /* set fields */
1215    ///         .send().await?;
1216    ///     println!("response {:?}", response);
1217    ///     Ok(())
1218    /// }
1219    /// ```
1220    pub fn get_operation(&self) -> super::builder::tenant_service::GetOperation {
1221        super::builder::tenant_service::GetOperation::new(self.inner.clone())
1222    }
1223}