Class v1beta.LfpInventoryServiceClient (0.2.0)

Service for a [LFP partner](https://support.google.com/merchants/answer/7676652) to submit local inventories for a merchant. v1beta

Package

@google-shopping/lfp

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of LfpInventoryServiceClient.

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 LfpInventoryServiceClient({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;

descriptors

descriptors: Descriptors;

innerApiCalls

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

lfpInventoryServiceStub

lfpInventoryServiceStub?: Promise<{
        [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

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.

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.

insertLfpInventory(request, options)

insertLfpInventory(request?: protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest, options?: CallOptions): Promise<[
        protos.google.shopping.merchant.lfp.v1beta.ILfpInventory,
        (protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest | undefined),
        {} | undefined
    ]>;

Inserts a LfpInventory resource for the given target merchant account. If the resource already exists, it will be replaced. The inventory automatically expires after 30 days.

Parameters
Name Description
request IInsertLfpInventoryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.shopping.merchant.lfp.v1beta.ILfpInventory, (protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing LfpInventory. 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 LFP provider account.
   *  Format: `accounts/{account}`
   */
  // const parent = 'abc123'
  /**
   *  Required. The inventory to insert.
   */
  // const lfpInventory = {}

  // Imports the Lfp library
  const {LfpInventoryServiceClient} = require('@google-shopping/lfp').v1beta;

  // Instantiates a client
  const lfpClient = new LfpInventoryServiceClient();

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

    // Run request
    const response = await lfpClient.insertLfpInventory(request);
    console.log(response);
  }

  callInsertLfpInventory();

insertLfpInventory(request, options, callback)

insertLfpInventory(request: protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest, options: CallOptions, callback: Callback<protos.google.shopping.merchant.lfp.v1beta.ILfpInventory, protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IInsertLfpInventoryRequest
options CallOptions
callback Callback<protos.google.shopping.merchant.lfp.v1beta.ILfpInventory, protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

insertLfpInventory(request, callback)

insertLfpInventory(request: protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest, callback: Callback<protos.google.shopping.merchant.lfp.v1beta.ILfpInventory, protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IInsertLfpInventoryRequest
callback Callback<protos.google.shopping.merchant.lfp.v1beta.ILfpInventory, protos.google.shopping.merchant.lfp.v1beta.IInsertLfpInventoryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

lfpInventoryPath(account, targetMerchant, storeCode, offer)

lfpInventoryPath(account: string, targetMerchant: string, storeCode: string, offer: string): string;

Return a fully-qualified lfpInventory resource name string.

Parameters
Name Description
account string
targetMerchant string
storeCode string
offer string
Returns
Type Description
string

{string} Resource name string.

lfpSalePath(account, sale)

lfpSalePath(account: string, sale: string): string;

Return a fully-qualified lfpSale resource name string.

Parameters
Name Description
account string
sale string
Returns
Type Description
string

{string} Resource name string.

lfpStorePath(account, targetMerchant, storeCode)

lfpStorePath(account: string, targetMerchant: string, storeCode: string): string;

Return a fully-qualified lfpStore resource name string.

Parameters
Name Description
account string
targetMerchant string
storeCode string
Returns
Type Description
string

{string} Resource name string.

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.

matchAccountFromLfpInventoryName(lfpInventoryName)

matchAccountFromLfpInventoryName(lfpInventoryName: string): string | number;

Parse the account from LfpInventory resource.

Parameter
Name Description
lfpInventoryName string

A fully-qualified path representing LfpInventory resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromLfpSaleName(lfpSaleName)

matchAccountFromLfpSaleName(lfpSaleName: string): string | number;

Parse the account from LfpSale resource.

Parameter
Name Description
lfpSaleName string

A fully-qualified path representing LfpSale resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromLfpStoreName(lfpStoreName)

matchAccountFromLfpStoreName(lfpStoreName: string): string | number;

Parse the account from LfpStore resource.

Parameter
Name Description
lfpStoreName string

A fully-qualified path representing LfpStore resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchOfferFromLfpInventoryName(lfpInventoryName)

matchOfferFromLfpInventoryName(lfpInventoryName: string): string | number;

Parse the offer from LfpInventory resource.

Parameter
Name Description
lfpInventoryName string

A fully-qualified path representing LfpInventory resource.

Returns
Type Description
string | number

{string} A string representing the offer.

matchSaleFromLfpSaleName(lfpSaleName)

matchSaleFromLfpSaleName(lfpSaleName: string): string | number;

Parse the sale from LfpSale resource.

Parameter
Name Description
lfpSaleName string

A fully-qualified path representing LfpSale resource.

Returns
Type Description
string | number

{string} A string representing the sale.

matchStoreCodeFromLfpInventoryName(lfpInventoryName)

matchStoreCodeFromLfpInventoryName(lfpInventoryName: string): string | number;

Parse the store_code from LfpInventory resource.

Parameter
Name Description
lfpInventoryName string

A fully-qualified path representing LfpInventory resource.

Returns
Type Description
string | number

{string} A string representing the store_code.

matchStoreCodeFromLfpStoreName(lfpStoreName)

matchStoreCodeFromLfpStoreName(lfpStoreName: string): string | number;

Parse the store_code from LfpStore resource.

Parameter
Name Description
lfpStoreName string

A fully-qualified path representing LfpStore resource.

Returns
Type Description
string | number

{string} A string representing the store_code.

matchTargetMerchantFromLfpInventoryName(lfpInventoryName)

matchTargetMerchantFromLfpInventoryName(lfpInventoryName: string): string | number;

Parse the target_merchant from LfpInventory resource.

Parameter
Name Description
lfpInventoryName string

A fully-qualified path representing LfpInventory resource.

Returns
Type Description
string | number

{string} A string representing the target_merchant.

matchTargetMerchantFromLfpStoreName(lfpStoreName)

matchTargetMerchantFromLfpStoreName(lfpStoreName: string): string | number;

Parse the target_merchant from LfpStore resource.

Parameter
Name Description
lfpStoreName string

A fully-qualified path representing LfpStore resource.

Returns
Type Description
string | number

{string} A string representing the target_merchant.