pub struct AccountLabelsService { /* private fields */ }Expand description
Implements a client for the CSS API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
async fn sample(
account_id: &str,
) -> anyhow::Result<()> {
let client = AccountLabelsService::builder().build().await?;
let mut list = client.list_account_labels()
.set_parent(format!("accounts/{account_id}"))
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}§Service Description
Manages Merchant Center and CSS accounts labels.
§Configuration
To configure AccountLabelsService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://css.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured with Private Google Access with VPC Service Controls) may want to override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
AccountLabelsService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap AccountLabelsService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl AccountLabelsService
impl AccountLabelsService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for AccountLabelsService.
let client = AccountLabelsService::builder().build().await?;Sourcepub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: AccountLabelsService + 'static,
pub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: AccountLabelsService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn list_account_labels(&self) -> ListAccountLabels
pub fn list_account_labels(&self) -> ListAccountLabels
Lists the labels owned by an account.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_shopping_css_v1::Result;
async fn sample(
client: &AccountLabelsService, account_id: &str
) -> Result<()> {
let mut list = client.list_account_labels()
.set_parent(format!("accounts/{account_id}"))
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn create_account_label(&self) -> CreateAccountLabel
pub fn create_account_label(&self) -> CreateAccountLabel
Creates a new label, not assigned to any account.
§Example
use google_shopping_css_v1::model::AccountLabel;
use google_shopping_css_v1::Result;
async fn sample(
client: &AccountLabelsService, account_id: &str
) -> Result<()> {
let response = client.create_account_label()
.set_parent(format!("accounts/{account_id}"))
.set_account_label(
AccountLabel::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_account_label(&self) -> UpdateAccountLabel
pub fn update_account_label(&self) -> UpdateAccountLabel
Updates a label.
§Example
use google_shopping_css_v1::model::AccountLabel;
use google_shopping_css_v1::Result;
async fn sample(
client: &AccountLabelsService, account_id: &str, label_id: &str
) -> Result<()> {
let response = client.update_account_label()
.set_account_label(
AccountLabel::new().set_name(format!("accounts/{account_id}/labels/{label_id}"))/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_account_label(&self) -> DeleteAccountLabel
pub fn delete_account_label(&self) -> DeleteAccountLabel
Deletes a label and removes it from all accounts to which it was assigned.
§Example
use google_shopping_css_v1::Result;
async fn sample(
client: &AccountLabelsService, account_id: &str, label_id: &str
) -> Result<()> {
client.delete_account_label()
.set_name(format!("accounts/{account_id}/labels/{label_id}"))
.send().await?;
Ok(())
}Trait Implementations§
Source§impl Clone for AccountLabelsService
impl Clone for AccountLabelsService
Source§fn clone(&self) -> AccountLabelsService
fn clone(&self) -> AccountLabelsService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more