Skip to main content

google_shopping_css_v1/
client.rs

1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the CSS API.
22///
23/// # Example
24/// ```
25/// # use google_shopping_css_v1::client::AccountsService;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28///    account_id: &str,
29/// ) -> anyhow::Result<()> {
30///     let client = AccountsService::builder().build().await?;
31///     let mut list = client.list_child_accounts()
32///         .set_parent(format!("accounts/{account_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/// Service for managing CSS/MC account information.
44///
45/// # Configuration
46///
47/// To configure `AccountsService` use the `with_*` methods in the type returned
48/// by [builder()][AccountsService::builder]. The default configuration should
49/// work for most applications. Common configuration changes include
50///
51/// * [with_endpoint()]: by default this client uses the global default endpoint
52///   (`https://css.googleapis.com`). Applications using regional
53///   endpoints or running in restricted networks (e.g. a network configured
54///   with [Private Google Access with VPC Service Controls]) may want to
55///   override this default.
56/// * [with_credentials()]: by default this client uses
57///   [Application Default Credentials]. Applications using custom
58///   authentication may need to override this default.
59///
60/// [with_endpoint()]: super::builder::accounts_service::ClientBuilder::with_endpoint
61/// [with_credentials()]: super::builder::accounts_service::ClientBuilder::with_credentials
62/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
63/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
64///
65/// # Pooling and Cloning
66///
67/// `AccountsService` holds a connection pool internally, it is advised to
68/// create one and reuse it. You do not need to wrap `AccountsService` in
69/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
70/// already uses an `Arc` internally.
71#[derive(Clone, Debug)]
72pub struct AccountsService {
73    inner: std::sync::Arc<dyn super::stub::dynamic::AccountsService>,
74}
75
76impl AccountsService {
77    /// Returns a builder for [AccountsService].
78    ///
79    /// ```
80    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81    /// # use google_shopping_css_v1::client::AccountsService;
82    /// let client = AccountsService::builder().build().await?;
83    /// # Ok(()) }
84    /// ```
85    pub fn builder() -> super::builder::accounts_service::ClientBuilder {
86        crate::new_client_builder(super::builder::accounts_service::client::Factory)
87    }
88
89    /// Creates a new client from the provided stub.
90    ///
91    /// The most common case for calling this function is in tests mocking the
92    /// client's behavior.
93    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
94    where
95        T: super::stub::AccountsService + 'static,
96    {
97        Self { inner: stub.into() }
98    }
99
100    pub(crate) async fn new(
101        config: gaxi::options::ClientConfig,
102    ) -> crate::ClientBuilderResult<Self> {
103        let inner = Self::build_inner(config).await?;
104        Ok(Self { inner })
105    }
106
107    async fn build_inner(
108        conf: gaxi::options::ClientConfig,
109    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AccountsService>> {
110        if gaxi::options::tracing_enabled(&conf) {
111            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
112        }
113        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
114    }
115
116    async fn build_transport(
117        conf: gaxi::options::ClientConfig,
118    ) -> crate::ClientBuilderResult<impl super::stub::AccountsService> {
119        super::transport::AccountsService::new(conf).await
120    }
121
122    async fn build_with_tracing(
123        conf: gaxi::options::ClientConfig,
124    ) -> crate::ClientBuilderResult<impl super::stub::AccountsService> {
125        Self::build_transport(conf)
126            .await
127            .map(super::tracing::AccountsService::new)
128    }
129
130    /// Lists all the accounts under the specified CSS account ID, and
131    /// optionally filters by label ID and account name.
132    ///
133    /// # Example
134    /// ```
135    /// # use google_shopping_css_v1::client::AccountsService;
136    /// use google_cloud_gax::paginator::ItemPaginator as _;
137    /// use google_shopping_css_v1::Result;
138    /// async fn sample(
139    ///    client: &AccountsService, account_id: &str
140    /// ) -> Result<()> {
141    ///     let mut list = client.list_child_accounts()
142    ///         .set_parent(format!("accounts/{account_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_child_accounts(&self) -> super::builder::accounts_service::ListChildAccounts {
151        super::builder::accounts_service::ListChildAccounts::new(self.inner.clone())
152    }
153
154    /// Retrieves a single CSS/MC account by ID.
155    ///
156    /// # Example
157    /// ```
158    /// # use google_shopping_css_v1::client::AccountsService;
159    /// use google_shopping_css_v1::Result;
160    /// async fn sample(
161    ///    client: &AccountsService, account_id: &str
162    /// ) -> Result<()> {
163    ///     let response = client.get_account()
164    ///         .set_name(format!("accounts/{account_id}"))
165    ///         .send().await?;
166    ///     println!("response {:?}", response);
167    ///     Ok(())
168    /// }
169    /// ```
170    pub fn get_account(&self) -> super::builder::accounts_service::GetAccount {
171        super::builder::accounts_service::GetAccount::new(self.inner.clone())
172    }
173
174    /// Updates labels assigned to CSS/MC accounts by a CSS domain.
175    ///
176    /// # Example
177    /// ```
178    /// # use google_shopping_css_v1::client::AccountsService;
179    /// use google_shopping_css_v1::Result;
180    /// async fn sample(
181    ///    client: &AccountsService
182    /// ) -> Result<()> {
183    ///     let response = client.update_labels()
184    ///         /* set fields */
185    ///         .send().await?;
186    ///     println!("response {:?}", response);
187    ///     Ok(())
188    /// }
189    /// ```
190    pub fn update_labels(&self) -> super::builder::accounts_service::UpdateLabels {
191        super::builder::accounts_service::UpdateLabels::new(self.inner.clone())
192    }
193}
194
195/// Implements a client for the CSS API.
196///
197/// # Example
198/// ```
199/// # use google_shopping_css_v1::client::AccountLabelsService;
200/// use google_cloud_gax::paginator::ItemPaginator as _;
201/// async fn sample(
202///    account_id: &str,
203/// ) -> anyhow::Result<()> {
204///     let client = AccountLabelsService::builder().build().await?;
205///     let mut list = client.list_account_labels()
206///         .set_parent(format!("accounts/{account_id}"))
207///         .by_item();
208///     while let Some(item) = list.next().await.transpose()? {
209///         println!("{:?}", item);
210///     }
211///     Ok(())
212/// }
213/// ```
214///
215/// # Service Description
216///
217/// Manages Merchant Center and CSS accounts labels.
218///
219/// # Configuration
220///
221/// To configure `AccountLabelsService` use the `with_*` methods in the type returned
222/// by [builder()][AccountLabelsService::builder]. The default configuration should
223/// work for most applications. Common configuration changes include
224///
225/// * [with_endpoint()]: by default this client uses the global default endpoint
226///   (`https://css.googleapis.com`). Applications using regional
227///   endpoints or running in restricted networks (e.g. a network configured
228///   with [Private Google Access with VPC Service Controls]) may want to
229///   override this default.
230/// * [with_credentials()]: by default this client uses
231///   [Application Default Credentials]. Applications using custom
232///   authentication may need to override this default.
233///
234/// [with_endpoint()]: super::builder::account_labels_service::ClientBuilder::with_endpoint
235/// [with_credentials()]: super::builder::account_labels_service::ClientBuilder::with_credentials
236/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
237/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
238///
239/// # Pooling and Cloning
240///
241/// `AccountLabelsService` holds a connection pool internally, it is advised to
242/// create one and reuse it. You do not need to wrap `AccountLabelsService` in
243/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
244/// already uses an `Arc` internally.
245#[derive(Clone, Debug)]
246pub struct AccountLabelsService {
247    inner: std::sync::Arc<dyn super::stub::dynamic::AccountLabelsService>,
248}
249
250impl AccountLabelsService {
251    /// Returns a builder for [AccountLabelsService].
252    ///
253    /// ```
254    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
255    /// # use google_shopping_css_v1::client::AccountLabelsService;
256    /// let client = AccountLabelsService::builder().build().await?;
257    /// # Ok(()) }
258    /// ```
259    pub fn builder() -> super::builder::account_labels_service::ClientBuilder {
260        crate::new_client_builder(super::builder::account_labels_service::client::Factory)
261    }
262
263    /// Creates a new client from the provided stub.
264    ///
265    /// The most common case for calling this function is in tests mocking the
266    /// client's behavior.
267    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
268    where
269        T: super::stub::AccountLabelsService + 'static,
270    {
271        Self { inner: stub.into() }
272    }
273
274    pub(crate) async fn new(
275        config: gaxi::options::ClientConfig,
276    ) -> crate::ClientBuilderResult<Self> {
277        let inner = Self::build_inner(config).await?;
278        Ok(Self { inner })
279    }
280
281    async fn build_inner(
282        conf: gaxi::options::ClientConfig,
283    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AccountLabelsService>>
284    {
285        if gaxi::options::tracing_enabled(&conf) {
286            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
287        }
288        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
289    }
290
291    async fn build_transport(
292        conf: gaxi::options::ClientConfig,
293    ) -> crate::ClientBuilderResult<impl super::stub::AccountLabelsService> {
294        super::transport::AccountLabelsService::new(conf).await
295    }
296
297    async fn build_with_tracing(
298        conf: gaxi::options::ClientConfig,
299    ) -> crate::ClientBuilderResult<impl super::stub::AccountLabelsService> {
300        Self::build_transport(conf)
301            .await
302            .map(super::tracing::AccountLabelsService::new)
303    }
304
305    /// Lists the labels owned by an account.
306    ///
307    /// # Example
308    /// ```
309    /// # use google_shopping_css_v1::client::AccountLabelsService;
310    /// use google_cloud_gax::paginator::ItemPaginator as _;
311    /// use google_shopping_css_v1::Result;
312    /// async fn sample(
313    ///    client: &AccountLabelsService, account_id: &str
314    /// ) -> Result<()> {
315    ///     let mut list = client.list_account_labels()
316    ///         .set_parent(format!("accounts/{account_id}"))
317    ///         .by_item();
318    ///     while let Some(item) = list.next().await.transpose()? {
319    ///         println!("{:?}", item);
320    ///     }
321    ///     Ok(())
322    /// }
323    /// ```
324    pub fn list_account_labels(&self) -> super::builder::account_labels_service::ListAccountLabels {
325        super::builder::account_labels_service::ListAccountLabels::new(self.inner.clone())
326    }
327
328    /// Creates a new label, not assigned to any account.
329    ///
330    /// # Example
331    /// ```
332    /// # use google_shopping_css_v1::client::AccountLabelsService;
333    /// use google_shopping_css_v1::model::AccountLabel;
334    /// use google_shopping_css_v1::Result;
335    /// async fn sample(
336    ///    client: &AccountLabelsService, account_id: &str
337    /// ) -> Result<()> {
338    ///     let response = client.create_account_label()
339    ///         .set_parent(format!("accounts/{account_id}"))
340    ///         .set_account_label(
341    ///             AccountLabel::new()/* set fields */
342    ///         )
343    ///         .send().await?;
344    ///     println!("response {:?}", response);
345    ///     Ok(())
346    /// }
347    /// ```
348    pub fn create_account_label(
349        &self,
350    ) -> super::builder::account_labels_service::CreateAccountLabel {
351        super::builder::account_labels_service::CreateAccountLabel::new(self.inner.clone())
352    }
353
354    /// Updates a label.
355    ///
356    /// # Example
357    /// ```
358    /// # use google_shopping_css_v1::client::AccountLabelsService;
359    /// use google_shopping_css_v1::model::AccountLabel;
360    /// use google_shopping_css_v1::Result;
361    /// async fn sample(
362    ///    client: &AccountLabelsService, account_id: &str, label_id: &str
363    /// ) -> Result<()> {
364    ///     let response = client.update_account_label()
365    ///         .set_account_label(
366    ///             AccountLabel::new().set_name(format!("accounts/{account_id}/labels/{label_id}"))/* set fields */
367    ///         )
368    ///         .send().await?;
369    ///     println!("response {:?}", response);
370    ///     Ok(())
371    /// }
372    /// ```
373    pub fn update_account_label(
374        &self,
375    ) -> super::builder::account_labels_service::UpdateAccountLabel {
376        super::builder::account_labels_service::UpdateAccountLabel::new(self.inner.clone())
377    }
378
379    /// Deletes a label and removes it from all accounts to which it was assigned.
380    ///
381    /// # Example
382    /// ```
383    /// # use google_shopping_css_v1::client::AccountLabelsService;
384    /// use google_shopping_css_v1::Result;
385    /// async fn sample(
386    ///    client: &AccountLabelsService, account_id: &str, label_id: &str
387    /// ) -> Result<()> {
388    ///     client.delete_account_label()
389    ///         .set_name(format!("accounts/{account_id}/labels/{label_id}"))
390    ///         .send().await?;
391    ///     Ok(())
392    /// }
393    /// ```
394    pub fn delete_account_label(
395        &self,
396    ) -> super::builder::account_labels_service::DeleteAccountLabel {
397        super::builder::account_labels_service::DeleteAccountLabel::new(self.inner.clone())
398    }
399}
400
401/// Implements a client for the CSS API.
402///
403/// # Example
404/// ```
405/// # use google_shopping_css_v1::client::CssProductInputsService;
406/// async fn sample(
407///    account_id: &str,
408///    css_product_input_id: &str,
409/// ) -> anyhow::Result<()> {
410///     let client = CssProductInputsService::builder().build().await?;
411///     client.delete_css_product_input()
412///         .set_name(format!("accounts/{account_id}/cssProductInputs/{css_product_input_id}"))
413///         .send().await?;
414///     Ok(())
415/// }
416/// ```
417///
418/// # Service Description
419///
420/// Service to use CssProductInput resource.
421/// This service helps to insert/update/delete CSS Products.
422///
423/// # Configuration
424///
425/// To configure `CssProductInputsService` use the `with_*` methods in the type returned
426/// by [builder()][CssProductInputsService::builder]. The default configuration should
427/// work for most applications. Common configuration changes include
428///
429/// * [with_endpoint()]: by default this client uses the global default endpoint
430///   (`https://css.googleapis.com`). Applications using regional
431///   endpoints or running in restricted networks (e.g. a network configured
432///   with [Private Google Access with VPC Service Controls]) may want to
433///   override this default.
434/// * [with_credentials()]: by default this client uses
435///   [Application Default Credentials]. Applications using custom
436///   authentication may need to override this default.
437///
438/// [with_endpoint()]: super::builder::css_product_inputs_service::ClientBuilder::with_endpoint
439/// [with_credentials()]: super::builder::css_product_inputs_service::ClientBuilder::with_credentials
440/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
441/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
442///
443/// # Pooling and Cloning
444///
445/// `CssProductInputsService` holds a connection pool internally, it is advised to
446/// create one and reuse it. You do not need to wrap `CssProductInputsService` in
447/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
448/// already uses an `Arc` internally.
449#[derive(Clone, Debug)]
450pub struct CssProductInputsService {
451    inner: std::sync::Arc<dyn super::stub::dynamic::CssProductInputsService>,
452}
453
454impl CssProductInputsService {
455    /// Returns a builder for [CssProductInputsService].
456    ///
457    /// ```
458    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
459    /// # use google_shopping_css_v1::client::CssProductInputsService;
460    /// let client = CssProductInputsService::builder().build().await?;
461    /// # Ok(()) }
462    /// ```
463    pub fn builder() -> super::builder::css_product_inputs_service::ClientBuilder {
464        crate::new_client_builder(super::builder::css_product_inputs_service::client::Factory)
465    }
466
467    /// Creates a new client from the provided stub.
468    ///
469    /// The most common case for calling this function is in tests mocking the
470    /// client's behavior.
471    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
472    where
473        T: super::stub::CssProductInputsService + 'static,
474    {
475        Self { inner: stub.into() }
476    }
477
478    pub(crate) async fn new(
479        config: gaxi::options::ClientConfig,
480    ) -> crate::ClientBuilderResult<Self> {
481        let inner = Self::build_inner(config).await?;
482        Ok(Self { inner })
483    }
484
485    async fn build_inner(
486        conf: gaxi::options::ClientConfig,
487    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CssProductInputsService>>
488    {
489        if gaxi::options::tracing_enabled(&conf) {
490            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
491        }
492        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
493    }
494
495    async fn build_transport(
496        conf: gaxi::options::ClientConfig,
497    ) -> crate::ClientBuilderResult<impl super::stub::CssProductInputsService> {
498        super::transport::CssProductInputsService::new(conf).await
499    }
500
501    async fn build_with_tracing(
502        conf: gaxi::options::ClientConfig,
503    ) -> crate::ClientBuilderResult<impl super::stub::CssProductInputsService> {
504        Self::build_transport(conf)
505            .await
506            .map(super::tracing::CssProductInputsService::new)
507    }
508
509    /// Uploads a CssProductInput to your CSS Center account. If an
510    /// input with the same contentLanguage, identity, feedLabel and feedId already
511    /// exists, this method replaces that entry.
512    ///
513    /// After inserting, updating, or deleting a CSS Product input, it may
514    /// take several minutes before the processed CSS Product can be retrieved.
515    ///
516    /// # Example
517    /// ```
518    /// # use google_shopping_css_v1::client::CssProductInputsService;
519    /// use google_shopping_css_v1::Result;
520    /// async fn sample(
521    ///    client: &CssProductInputsService
522    /// ) -> Result<()> {
523    ///     let response = client.insert_css_product_input()
524    ///         /* set fields */
525    ///         .send().await?;
526    ///     println!("response {:?}", response);
527    ///     Ok(())
528    /// }
529    /// ```
530    pub fn insert_css_product_input(
531        &self,
532    ) -> super::builder::css_product_inputs_service::InsertCssProductInput {
533        super::builder::css_product_inputs_service::InsertCssProductInput::new(self.inner.clone())
534    }
535
536    /// Updates the existing Css Product input in your CSS Center account.
537    ///
538    /// After inserting, updating, or deleting a CSS Product input, it may take
539    /// several minutes before the processed Css Product can be retrieved.
540    ///
541    /// # Example
542    /// ```
543    /// # use google_shopping_css_v1::client::CssProductInputsService;
544    /// # extern crate wkt as google_cloud_wkt;
545    /// use google_cloud_wkt::FieldMask;
546    /// use google_shopping_css_v1::model::CssProductInput;
547    /// use google_shopping_css_v1::Result;
548    /// async fn sample(
549    ///    client: &CssProductInputsService, account_id: &str, css_product_input_id: &str
550    /// ) -> Result<()> {
551    ///     let response = client.update_css_product_input()
552    ///         .set_css_product_input(
553    ///             CssProductInput::new().set_name(format!("accounts/{account_id}/cssProductInputs/{css_product_input_id}"))/* set fields */
554    ///         )
555    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
556    ///         .send().await?;
557    ///     println!("response {:?}", response);
558    ///     Ok(())
559    /// }
560    /// ```
561    pub fn update_css_product_input(
562        &self,
563    ) -> super::builder::css_product_inputs_service::UpdateCssProductInput {
564        super::builder::css_product_inputs_service::UpdateCssProductInput::new(self.inner.clone())
565    }
566
567    /// Deletes a CSS Product input from your CSS Center account.
568    ///
569    /// After a delete it may take several minutes until the input is no longer
570    /// available.
571    ///
572    /// # Example
573    /// ```
574    /// # use google_shopping_css_v1::client::CssProductInputsService;
575    /// use google_shopping_css_v1::Result;
576    /// async fn sample(
577    ///    client: &CssProductInputsService, account_id: &str, css_product_input_id: &str
578    /// ) -> Result<()> {
579    ///     client.delete_css_product_input()
580    ///         .set_name(format!("accounts/{account_id}/cssProductInputs/{css_product_input_id}"))
581    ///         .send().await?;
582    ///     Ok(())
583    /// }
584    /// ```
585    pub fn delete_css_product_input(
586        &self,
587    ) -> super::builder::css_product_inputs_service::DeleteCssProductInput {
588        super::builder::css_product_inputs_service::DeleteCssProductInput::new(self.inner.clone())
589    }
590}
591
592/// Implements a client for the CSS API.
593///
594/// # Example
595/// ```
596/// # use google_shopping_css_v1::client::CssProductsService;
597/// use google_cloud_gax::paginator::ItemPaginator as _;
598/// async fn sample(
599///    account_id: &str,
600/// ) -> anyhow::Result<()> {
601///     let client = CssProductsService::builder().build().await?;
602///     let mut list = client.list_css_products()
603///         .set_parent(format!("accounts/{account_id}"))
604///         .by_item();
605///     while let Some(item) = list.next().await.transpose()? {
606///         println!("{:?}", item);
607///     }
608///     Ok(())
609/// }
610/// ```
611///
612/// # Service Description
613///
614/// Service for doing get and list on Css Products(a.k.a Aggregate Offers
615/// internally).
616///
617/// # Configuration
618///
619/// To configure `CssProductsService` use the `with_*` methods in the type returned
620/// by [builder()][CssProductsService::builder]. The default configuration should
621/// work for most applications. Common configuration changes include
622///
623/// * [with_endpoint()]: by default this client uses the global default endpoint
624///   (`https://css.googleapis.com`). Applications using regional
625///   endpoints or running in restricted networks (e.g. a network configured
626///   with [Private Google Access with VPC Service Controls]) may want to
627///   override this default.
628/// * [with_credentials()]: by default this client uses
629///   [Application Default Credentials]. Applications using custom
630///   authentication may need to override this default.
631///
632/// [with_endpoint()]: super::builder::css_products_service::ClientBuilder::with_endpoint
633/// [with_credentials()]: super::builder::css_products_service::ClientBuilder::with_credentials
634/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
635/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
636///
637/// # Pooling and Cloning
638///
639/// `CssProductsService` holds a connection pool internally, it is advised to
640/// create one and reuse it. You do not need to wrap `CssProductsService` in
641/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
642/// already uses an `Arc` internally.
643#[derive(Clone, Debug)]
644pub struct CssProductsService {
645    inner: std::sync::Arc<dyn super::stub::dynamic::CssProductsService>,
646}
647
648impl CssProductsService {
649    /// Returns a builder for [CssProductsService].
650    ///
651    /// ```
652    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
653    /// # use google_shopping_css_v1::client::CssProductsService;
654    /// let client = CssProductsService::builder().build().await?;
655    /// # Ok(()) }
656    /// ```
657    pub fn builder() -> super::builder::css_products_service::ClientBuilder {
658        crate::new_client_builder(super::builder::css_products_service::client::Factory)
659    }
660
661    /// Creates a new client from the provided stub.
662    ///
663    /// The most common case for calling this function is in tests mocking the
664    /// client's behavior.
665    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
666    where
667        T: super::stub::CssProductsService + 'static,
668    {
669        Self { inner: stub.into() }
670    }
671
672    pub(crate) async fn new(
673        config: gaxi::options::ClientConfig,
674    ) -> crate::ClientBuilderResult<Self> {
675        let inner = Self::build_inner(config).await?;
676        Ok(Self { inner })
677    }
678
679    async fn build_inner(
680        conf: gaxi::options::ClientConfig,
681    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CssProductsService>>
682    {
683        if gaxi::options::tracing_enabled(&conf) {
684            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
685        }
686        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
687    }
688
689    async fn build_transport(
690        conf: gaxi::options::ClientConfig,
691    ) -> crate::ClientBuilderResult<impl super::stub::CssProductsService> {
692        super::transport::CssProductsService::new(conf).await
693    }
694
695    async fn build_with_tracing(
696        conf: gaxi::options::ClientConfig,
697    ) -> crate::ClientBuilderResult<impl super::stub::CssProductsService> {
698        Self::build_transport(conf)
699            .await
700            .map(super::tracing::CssProductsService::new)
701    }
702
703    /// Retrieves the processed CSS Product from your CSS Center account. After
704    /// inserting, updating, or deleting a product input, it may take several
705    /// minutes before the updated final product can be retrieved.
706    ///
707    /// # Example
708    /// ```
709    /// # use google_shopping_css_v1::client::CssProductsService;
710    /// use google_shopping_css_v1::Result;
711    /// async fn sample(
712    ///    client: &CssProductsService, account_id: &str, css_product_id: &str
713    /// ) -> Result<()> {
714    ///     let response = client.get_css_product()
715    ///         .set_name(format!("accounts/{account_id}/cssProducts/{css_product_id}"))
716    ///         .send().await?;
717    ///     println!("response {:?}", response);
718    ///     Ok(())
719    /// }
720    /// ```
721    pub fn get_css_product(&self) -> super::builder::css_products_service::GetCssProduct {
722        super::builder::css_products_service::GetCssProduct::new(self.inner.clone())
723    }
724
725    /// Lists the processed CSS Products in your CSS Center account. The response
726    /// might contain fewer items than specified by pageSize. Rely on pageToken to
727    /// determine if there are more items to be requested.
728    ///
729    /// After inserting, updating, or deleting a CSS product input, it may
730    /// take several minutes before the updated processed CSS product can be
731    /// retrieved.
732    ///
733    /// # Example
734    /// ```
735    /// # use google_shopping_css_v1::client::CssProductsService;
736    /// use google_cloud_gax::paginator::ItemPaginator as _;
737    /// use google_shopping_css_v1::Result;
738    /// async fn sample(
739    ///    client: &CssProductsService, account_id: &str
740    /// ) -> Result<()> {
741    ///     let mut list = client.list_css_products()
742    ///         .set_parent(format!("accounts/{account_id}"))
743    ///         .by_item();
744    ///     while let Some(item) = list.next().await.transpose()? {
745    ///         println!("{:?}", item);
746    ///     }
747    ///     Ok(())
748    /// }
749    /// ```
750    pub fn list_css_products(&self) -> super::builder::css_products_service::ListCssProducts {
751        super::builder::css_products_service::ListCssProducts::new(self.inner.clone())
752    }
753}
754
755/// Implements a client for the CSS API.
756///
757/// # Example
758/// ```
759/// # use google_shopping_css_v1::client::QuotaService;
760/// use google_cloud_gax::paginator::ItemPaginator as _;
761/// async fn sample(
762///    account_id: &str,
763/// ) -> anyhow::Result<()> {
764///     let client = QuotaService::builder().build().await?;
765///     let mut list = client.list_quota_groups()
766///         .set_parent(format!("accounts/{account_id}"))
767///         .by_item();
768///     while let Some(item) = list.next().await.transpose()? {
769///         println!("{:?}", item);
770///     }
771///     Ok(())
772/// }
773/// ```
774///
775/// # Service Description
776///
777/// Service to get method call quota information per CSS API method.
778///
779/// # Configuration
780///
781/// To configure `QuotaService` use the `with_*` methods in the type returned
782/// by [builder()][QuotaService::builder]. The default configuration should
783/// work for most applications. Common configuration changes include
784///
785/// * [with_endpoint()]: by default this client uses the global default endpoint
786///   (`https://css.googleapis.com`). Applications using regional
787///   endpoints or running in restricted networks (e.g. a network configured
788///   with [Private Google Access with VPC Service Controls]) may want to
789///   override this default.
790/// * [with_credentials()]: by default this client uses
791///   [Application Default Credentials]. Applications using custom
792///   authentication may need to override this default.
793///
794/// [with_endpoint()]: super::builder::quota_service::ClientBuilder::with_endpoint
795/// [with_credentials()]: super::builder::quota_service::ClientBuilder::with_credentials
796/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
797/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
798///
799/// # Pooling and Cloning
800///
801/// `QuotaService` holds a connection pool internally, it is advised to
802/// create one and reuse it. You do not need to wrap `QuotaService` in
803/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
804/// already uses an `Arc` internally.
805#[derive(Clone, Debug)]
806pub struct QuotaService {
807    inner: std::sync::Arc<dyn super::stub::dynamic::QuotaService>,
808}
809
810impl QuotaService {
811    /// Returns a builder for [QuotaService].
812    ///
813    /// ```
814    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
815    /// # use google_shopping_css_v1::client::QuotaService;
816    /// let client = QuotaService::builder().build().await?;
817    /// # Ok(()) }
818    /// ```
819    pub fn builder() -> super::builder::quota_service::ClientBuilder {
820        crate::new_client_builder(super::builder::quota_service::client::Factory)
821    }
822
823    /// Creates a new client from the provided stub.
824    ///
825    /// The most common case for calling this function is in tests mocking the
826    /// client's behavior.
827    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
828    where
829        T: super::stub::QuotaService + 'static,
830    {
831        Self { inner: stub.into() }
832    }
833
834    pub(crate) async fn new(
835        config: gaxi::options::ClientConfig,
836    ) -> crate::ClientBuilderResult<Self> {
837        let inner = Self::build_inner(config).await?;
838        Ok(Self { inner })
839    }
840
841    async fn build_inner(
842        conf: gaxi::options::ClientConfig,
843    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::QuotaService>> {
844        if gaxi::options::tracing_enabled(&conf) {
845            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
846        }
847        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
848    }
849
850    async fn build_transport(
851        conf: gaxi::options::ClientConfig,
852    ) -> crate::ClientBuilderResult<impl super::stub::QuotaService> {
853        super::transport::QuotaService::new(conf).await
854    }
855
856    async fn build_with_tracing(
857        conf: gaxi::options::ClientConfig,
858    ) -> crate::ClientBuilderResult<impl super::stub::QuotaService> {
859        Self::build_transport(conf)
860            .await
861            .map(super::tracing::QuotaService::new)
862    }
863
864    /// Lists the daily call quota and usage per group for your CSS Center account.
865    ///
866    /// # Example
867    /// ```
868    /// # use google_shopping_css_v1::client::QuotaService;
869    /// use google_cloud_gax::paginator::ItemPaginator as _;
870    /// use google_shopping_css_v1::Result;
871    /// async fn sample(
872    ///    client: &QuotaService, account_id: &str
873    /// ) -> Result<()> {
874    ///     let mut list = client.list_quota_groups()
875    ///         .set_parent(format!("accounts/{account_id}"))
876    ///         .by_item();
877    ///     while let Some(item) = list.next().await.transpose()? {
878    ///         println!("{:?}", item);
879    ///     }
880    ///     Ok(())
881    /// }
882    /// ```
883    pub fn list_quota_groups(&self) -> super::builder::quota_service::ListQuotaGroups {
884        super::builder::quota_service::ListQuotaGroups::new(self.inner.clone())
885    }
886}