Class v1.AccountLabelsServiceClient (0.4.0)

Manages Merchant Center and CSS accounts labels. v1

Package

@google-shopping/css

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of AccountLabelsServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new AccountLabelsServiceClient({fallback: true}, gax); ```

Properties

accountLabelsServiceStub

accountLabelsServiceStub?: Promise<{
        [name: string]: Function;
    }>;

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

accountLabelPath(account, label)

accountLabelPath(account: string, label: string): string;

Return a fully-qualified accountLabel resource name string.

Parameters
Name Description
account string
label string
Returns
Type Description
string

{string} Resource name string.

accountPath(account)

accountPath(account: string): string;

Return a fully-qualified account resource name string.

Parameter
Name Description
account string
Returns
Type Description
string

{string} Resource name string.

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

createAccountLabel(request, options)

createAccountLabel(request?: protos.google.shopping.css.v1.ICreateAccountLabelRequest, options?: CallOptions): Promise<[
        protos.google.shopping.css.v1.IAccountLabel,
        protos.google.shopping.css.v1.ICreateAccountLabelRequest | undefined,
        {} | undefined
    ]>;

Creates a new label, not assigned to any account.

Parameters
Name Description
request ICreateAccountLabelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.ICreateAccountLabelRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent account.
   *  Format: accounts/{account}
   */
  // const parent = 'abc123'
  /**
   *  Required. The label to create.
   */
  // const accountLabel = {}

  // Imports the Css library
  const {AccountLabelsServiceClient} = require('@google-shopping/css').v1;

  // Instantiates a client
  const cssClient = new AccountLabelsServiceClient();

  async function callCreateAccountLabel() {
    // Construct request
    const request = {
      parent,
      accountLabel,
    };

    // Run request
    const response = await cssClient.createAccountLabel(request);
    console.log(response);
  }

  callCreateAccountLabel();

createAccountLabel(request, options, callback)

createAccountLabel(request: protos.google.shopping.css.v1.ICreateAccountLabelRequest, options: CallOptions, callback: Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.ICreateAccountLabelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAccountLabelRequest
options CallOptions
callback Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.ICreateAccountLabelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createAccountLabel(request, callback)

createAccountLabel(request: protos.google.shopping.css.v1.ICreateAccountLabelRequest, callback: Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.ICreateAccountLabelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAccountLabelRequest
callback Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.ICreateAccountLabelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

cssProductInputPath(account, cssProductInput)

cssProductInputPath(account: string, cssProductInput: string): string;

Return a fully-qualified cssProductInput resource name string.

Parameters
Name Description
account string
cssProductInput string
Returns
Type Description
string

{string} Resource name string.

cssProductPath(account, cssProduct)

cssProductPath(account: string, cssProduct: string): string;

Return a fully-qualified cssProduct resource name string.

Parameters
Name Description
account string
cssProduct string
Returns
Type Description
string

{string} Resource name string.

deleteAccountLabel(request, options)

deleteAccountLabel(request?: protos.google.shopping.css.v1.IDeleteAccountLabelRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.shopping.css.v1.IDeleteAccountLabelRequest | undefined,
        {} | undefined
    ]>;

Deletes a label and removes it from all accounts to which it was assigned.

Parameters
Name Description
request IDeleteAccountLabelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteAccountLabelRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the label to delete.
   *  Format:  accounts/{account}/labels/{label}
   */
  // const name = 'abc123'

  // Imports the Css library
  const {AccountLabelsServiceClient} = require('@google-shopping/css').v1;

  // Instantiates a client
  const cssClient = new AccountLabelsServiceClient();

  async function callDeleteAccountLabel() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await cssClient.deleteAccountLabel(request);
    console.log(response);
  }

  callDeleteAccountLabel();

deleteAccountLabel(request, options, callback)

deleteAccountLabel(request: protos.google.shopping.css.v1.IDeleteAccountLabelRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteAccountLabelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAccountLabelRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteAccountLabelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteAccountLabel(request, callback)

deleteAccountLabel(request: protos.google.shopping.css.v1.IDeleteAccountLabelRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteAccountLabelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAccountLabelRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteAccountLabelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listAccountLabels(request, options)

listAccountLabels(request?: protos.google.shopping.css.v1.IListAccountLabelsRequest, options?: CallOptions): Promise<[
        protos.google.shopping.css.v1.IAccountLabel[],
        protos.google.shopping.css.v1.IListAccountLabelsRequest | null,
        protos.google.shopping.css.v1.IListAccountLabelsResponse
    ]>;

Lists the labels assigned to an account.

Parameters
Name Description
request IListAccountLabelsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.shopping.css.v1.IAccountLabel[], protos.google.shopping.css.v1.IListAccountLabelsRequest | null, protos.google.shopping.css.v1.IListAccountLabelsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listAccountLabelsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAccountLabels(request, options, callback)

listAccountLabels(request: protos.google.shopping.css.v1.IListAccountLabelsRequest, options: CallOptions, callback: PaginationCallback<protos.google.shopping.css.v1.IListAccountLabelsRequest, protos.google.shopping.css.v1.IListAccountLabelsResponse | null | undefined, protos.google.shopping.css.v1.IAccountLabel>): void;
Parameters
Name Description
request IListAccountLabelsRequest
options CallOptions
callback PaginationCallback<protos.google.shopping.css.v1.IListAccountLabelsRequest, protos.google.shopping.css.v1.IListAccountLabelsResponse | null | undefined, protos.google.shopping.css.v1.IAccountLabel>
Returns
Type Description
void

listAccountLabels(request, callback)

listAccountLabels(request: protos.google.shopping.css.v1.IListAccountLabelsRequest, callback: PaginationCallback<protos.google.shopping.css.v1.IListAccountLabelsRequest, protos.google.shopping.css.v1.IListAccountLabelsResponse | null | undefined, protos.google.shopping.css.v1.IAccountLabel>): void;
Parameters
Name Description
request IListAccountLabelsRequest
callback PaginationCallback<protos.google.shopping.css.v1.IListAccountLabelsRequest, protos.google.shopping.css.v1.IListAccountLabelsResponse | null | undefined, protos.google.shopping.css.v1.IAccountLabel>
Returns
Type Description
void

listAccountLabelsAsync(request, options)

listAccountLabelsAsync(request?: protos.google.shopping.css.v1.IListAccountLabelsRequest, options?: CallOptions): AsyncIterable<protos.google.shopping.css.v1.IAccountLabel>;

Equivalent to listAccountLabels, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListAccountLabelsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.shopping.css.v1.IAccountLabel>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent account.
   *  Format: accounts/{account}
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of labels to return. The service may return fewer than
   *  this value.
   *  If unspecified, at most 50 labels will be returned.
   *  The maximum value is 1000; values above 1000 will be coerced to 1000.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous `ListAccountLabels` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListAccountLabels` must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'

  // Imports the Css library
  const {AccountLabelsServiceClient} = require('@google-shopping/css').v1;

  // Instantiates a client
  const cssClient = new AccountLabelsServiceClient();

  async function callListAccountLabels() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = cssClient.listAccountLabelsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListAccountLabels();

listAccountLabelsStream(request, options)

listAccountLabelsStream(request?: protos.google.shopping.css.v1.IListAccountLabelsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListAccountLabelsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listAccountLabelsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchAccountFromAccountLabelName(accountLabelName)

matchAccountFromAccountLabelName(accountLabelName: string): string | number;

Parse the account from AccountLabel resource.

Parameter
Name Description
accountLabelName string

A fully-qualified path representing AccountLabel resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromAccountName(accountName)

matchAccountFromAccountName(accountName: string): string | number;

Parse the account from Account resource.

Parameter
Name Description
accountName string

A fully-qualified path representing Account resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromCssProductInputName(cssProductInputName)

matchAccountFromCssProductInputName(cssProductInputName: string): string | number;

Parse the account from CssProductInput resource.

Parameter
Name Description
cssProductInputName string

A fully-qualified path representing CssProductInput resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromCssProductName(cssProductName)

matchAccountFromCssProductName(cssProductName: string): string | number;

Parse the account from CssProduct resource.

Parameter
Name Description
cssProductName string

A fully-qualified path representing CssProduct resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchCssProductFromCssProductName(cssProductName)

matchCssProductFromCssProductName(cssProductName: string): string | number;

Parse the css_product from CssProduct resource.

Parameter
Name Description
cssProductName string

A fully-qualified path representing CssProduct resource.

Returns
Type Description
string | number

{string} A string representing the css_product.

matchCssProductInputFromCssProductInputName(cssProductInputName)

matchCssProductInputFromCssProductInputName(cssProductInputName: string): string | number;

Parse the css_product_input from CssProductInput resource.

Parameter
Name Description
cssProductInputName string

A fully-qualified path representing CssProductInput resource.

Returns
Type Description
string | number

{string} A string representing the css_product_input.

matchLabelFromAccountLabelName(accountLabelName)

matchLabelFromAccountLabelName(accountLabelName: string): string | number;

Parse the label from AccountLabel resource.

Parameter
Name Description
accountLabelName string

A fully-qualified path representing AccountLabel resource.

Returns
Type Description
string | number

{string} A string representing the label.

updateAccountLabel(request, options)

updateAccountLabel(request?: protos.google.shopping.css.v1.IUpdateAccountLabelRequest, options?: CallOptions): Promise<[
        protos.google.shopping.css.v1.IAccountLabel,
        protos.google.shopping.css.v1.IUpdateAccountLabelRequest | undefined,
        {} | undefined
    ]>;

Updates a label.

Parameters
Name Description
request IUpdateAccountLabelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.IUpdateAccountLabelRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The updated label. All fields must be provided.
   */
  // const accountLabel = {}

  // Imports the Css library
  const {AccountLabelsServiceClient} = require('@google-shopping/css').v1;

  // Instantiates a client
  const cssClient = new AccountLabelsServiceClient();

  async function callUpdateAccountLabel() {
    // Construct request
    const request = {
      accountLabel,
    };

    // Run request
    const response = await cssClient.updateAccountLabel(request);
    console.log(response);
  }

  callUpdateAccountLabel();

updateAccountLabel(request, options, callback)

updateAccountLabel(request: protos.google.shopping.css.v1.IUpdateAccountLabelRequest, options: CallOptions, callback: Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.IUpdateAccountLabelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateAccountLabelRequest
options CallOptions
callback Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.IUpdateAccountLabelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateAccountLabel(request, callback)

updateAccountLabel(request: protos.google.shopping.css.v1.IUpdateAccountLabelRequest, callback: Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.IUpdateAccountLabelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateAccountLabelRequest
callback Callback<protos.google.shopping.css.v1.IAccountLabel, protos.google.shopping.css.v1.IUpdateAccountLabelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void