Class v1.CssProductInputsServiceClient (0.4.0)

Service to use CssProductInput resource. This service helps to insert/update/delete CSS Products. v1

Package

@google-shopping/css

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of CssProductInputsServiceClient.

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 CssProductInputsServiceClient({fallback: true}, gax); ```

Properties

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;

cssProductInputsServiceStub

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

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.

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.

deleteCssProductInput(request, options)

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

Deletes a CSS Product input from your CSS Center account.

After a delete it may take several minutes until the input is no longer available.

Parameters
Name Description
request IDeleteCssProductInputRequest

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.IDeleteCssProductInputRequest | 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 CSS product input resource to delete.
   *  Format: accounts/{account}/cssProductInputs/{css_product_input}
   */
  // const name = 'abc123'
  /**
   *  The Content API Supplemental Feed ID.
   *  The field must not be set if the action applies to a primary feed.
   *  If the field is set, then product action applies to a supplemental feed
   *  instead of primary Content API feed.
   */
  // const supplementalFeedId = 1234

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

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

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

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

  callDeleteCssProductInput();

deleteCssProductInput(request, options, callback)

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

deleteCssProductInput(request, callback)

deleteCssProductInput(request: protos.google.shopping.css.v1.IDeleteCssProductInputRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteCssProductInputRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteCssProductInputRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.shopping.css.v1.IDeleteCssProductInputRequest | 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.

insertCssProductInput(request, options)

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

Uploads a CssProductInput to your CSS Center account. If an input with the same contentLanguage, identity, feedLabel and feedId already exists, this method replaces that entry.

After inserting, updating, or deleting a CSS Product input, it may take several minutes before the processed CSS Product can be retrieved.

Parameters
Name Description
request IInsertCssProductInputRequest

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.ICssProductInput, protos.google.shopping.css.v1.IInsertCssProductInputRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing CssProductInput. 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 account where this CSS Product will be inserted.
   *  Format: accounts/{account}
   */
  // const parent = 'abc123'
  /**
   *  Required. The CSS Product Input to insert.
   */
  // const cssProductInput = {}
  /**
   *  Required. The primary or supplemental feed id. If CSS Product already
   *  exists and feed id provided is different, then the CSS Product will be
   *  moved to a new feed. Note: For now, CSSs do not need to provide feed ids as
   *  we create feeds on the fly. We do not have supplemental feed support for
   *  CSS Products yet.
   */
  // const feedId = 1234

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

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

  async function callInsertCssProductInput() {
    // Construct request
    const request = {
      parent,
      cssProductInput,
      feedId,
    };

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

  callInsertCssProductInput();

insertCssProductInput(request, options, callback)

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

insertCssProductInput(request, callback)

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

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.