UNPKG

@google-cloud/retail

Version:
816 lines 106 kB
import type * as gax from 'google-gax'; import type { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, LocationsClient, LocationProtos } from 'google-gax'; import { Transform } from 'stream'; import * as protos from '../../protos/protos'; /** * Service for ingesting {@link protos.google.cloud.retail.v2.Product|Product} information * of the customer's website. * @class * @memberof v2 */ export declare class ProductServiceClient { private _terminated; private _opts; private _providedCustomServicePath; private _gaxModule; private _gaxGrpc; private _protos; private _defaults; private _universeDomain; private _servicePath; private _log; auth: gax.GoogleAuth; descriptors: Descriptors; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: { [name: string]: Function; }; locationsClient: LocationsClient; pathTemplates: { [name: string]: gax.PathTemplate; }; operationsClient: gax.OperationsClient; productServiceStub?: Promise<{ [name: string]: Function; }>; /** * Construct an instance of ProductServiceClient. * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] * @param {string} [options.email] - Account email address. Required when * using a .pem or .p12 keyFilename. * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or * .p12 key downloaded from the Google Developers Console. If you provide * a path to a JSON file, the projectId option below is not necessary. * NOTE: .pem and .p12 require you to specify options.email as well. * @param {number} [options.port] - The port on which to connect to * the remote host. * @param {string} [options.projectId] - The project ID from the Google * Developer's Console, e.g. 'grape-spaceship-123'. We will also check * the environment variable GCLOUD_PROJECT for your project ID. If your * app is running in an environment which supports * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. * For more information, please check the * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. * @param {gax} [gaxInstance]: 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 ProductServiceClient({fallback: true}, gax); * ``` */ constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback); /** * 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 {Promise} A promise that resolves to an authenticated service stub. */ initialize(): Promise<{ [name: string]: Function; }>; /** * The DNS address for this API service. * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath(): string; /** * The DNS address for this API service - same as servicePath. * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint(): string; /** * The DNS address for this API service. * @returns {string} The DNS address for this service. */ get apiEndpoint(): string; get universeDomain(): string; /** * The port for this API service. * @returns {number} The default port for this service. */ static get port(): number; /** * The scopes needed to make gRPC calls for every method defined * in this service. * @returns {string[]} List of default scopes. */ static get scopes(): string[]; getProjectId(): Promise<string>; getProjectId(callback: Callback<string, undefined, undefined>): void; /** * Creates a {@link protos.google.cloud.retail.v2.Product|Product}. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The parent catalog resource name, such as * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. * @param {google.cloud.retail.v2.Product} request.product * Required. The {@link protos.google.cloud.retail.v2.Product|Product} to create. * @param {string} request.productId * Required. The ID to use for the {@link protos.google.cloud.retail.v2.Product|Product}, * which will become the final component of the * {@link protos.google.cloud.retail.v2.Product.name|Product.name}. * * If the caller does not have permission to create the * {@link protos.google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * * This field must be unique among all * {@link protos.google.cloud.retail.v2.Product|Product}s with the same * {@link protos.google.cloud.retail.v2.CreateProductRequest.parent|parent}. Otherwise, an * ALREADY_EXISTS error is returned. * * This field must be a UTF-8 encoded string with a length limit of 128 * characters. Otherwise, an INVALID_ARGUMENT error is returned. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing {@link protos.google.cloud.retail.v2.Product|Product}. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.create_product.js</caption> * region_tag:retail_v2_generated_ProductService_CreateProduct_async */ createProduct(request?: protos.google.cloud.retail.v2.ICreateProductRequest, options?: CallOptions): Promise<[ protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.ICreateProductRequest | undefined, {} | undefined ]>; createProduct(request: protos.google.cloud.retail.v2.ICreateProductRequest, options: CallOptions, callback: Callback<protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, {} | null | undefined>): void; createProduct(request: protos.google.cloud.retail.v2.ICreateProductRequest, callback: Callback<protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.ICreateProductRequest | null | undefined, {} | null | undefined>): void; /** * Gets a {@link protos.google.cloud.retail.v2.Product|Product}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. Full resource name of {@link protos.google.cloud.retail.v2.Product|Product}, * such as * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to access the * {@link protos.google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * * If the requested {@link protos.google.cloud.retail.v2.Product|Product} does not exist, * a NOT_FOUND error is returned. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing {@link protos.google.cloud.retail.v2.Product|Product}. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.get_product.js</caption> * region_tag:retail_v2_generated_ProductService_GetProduct_async */ getProduct(request?: protos.google.cloud.retail.v2.IGetProductRequest, options?: CallOptions): Promise<[ protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.IGetProductRequest | undefined, {} | undefined ]>; getProduct(request: protos.google.cloud.retail.v2.IGetProductRequest, options: CallOptions, callback: Callback<protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.IGetProductRequest | null | undefined, {} | null | undefined>): void; getProduct(request: protos.google.cloud.retail.v2.IGetProductRequest, callback: Callback<protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.IGetProductRequest | null | undefined, {} | null | undefined>): void; /** * Updates a {@link protos.google.cloud.retail.v2.Product|Product}. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.retail.v2.Product} request.product * Required. The product to update/create. * * If the caller does not have permission to update the * {@link protos.google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * * If the {@link protos.google.cloud.retail.v2.Product|Product} to update does not exist * and * {@link protos.google.cloud.retail.v2.UpdateProductRequest.allow_missing|allow_missing} * is not set, a NOT_FOUND error is returned. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided * {@link protos.google.cloud.retail.v2.Product|Product} to update. The immutable and * output only fields are NOT supported. If not set, all supported fields (the * fields that are neither immutable nor output only) are updated. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned. * * The attribute key can be updated by setting the mask path as * "attributes.${key_name}". If a key name is present in the mask but not in * the patching product from the request, this key will be deleted after the * update. * @param {boolean} request.allowMissing * If set to true, and the {@link protos.google.cloud.retail.v2.Product|Product} is not * found, a new {@link protos.google.cloud.retail.v2.Product|Product} will be created. In * this situation, `update_mask` is ignored. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing {@link protos.google.cloud.retail.v2.Product|Product}. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.update_product.js</caption> * region_tag:retail_v2_generated_ProductService_UpdateProduct_async */ updateProduct(request?: protos.google.cloud.retail.v2.IUpdateProductRequest, options?: CallOptions): Promise<[ protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.IUpdateProductRequest | undefined, {} | undefined ]>; updateProduct(request: protos.google.cloud.retail.v2.IUpdateProductRequest, options: CallOptions, callback: Callback<protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, {} | null | undefined>): void; updateProduct(request: protos.google.cloud.retail.v2.IUpdateProductRequest, callback: Callback<protos.google.cloud.retail.v2.IProduct, protos.google.cloud.retail.v2.IUpdateProductRequest | null | undefined, {} | null | undefined>): void; /** * Deletes a {@link protos.google.cloud.retail.v2.Product|Product}. * * @param {Object} request * The request object that will be sent. * @param {string} request.name * Required. Full resource name of {@link protos.google.cloud.retail.v2.Product|Product}, * such as * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to delete the * {@link protos.google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * * If the {@link protos.google.cloud.retail.v2.Product|Product} to delete does not exist, * a NOT_FOUND error is returned. * * The {@link protos.google.cloud.retail.v2.Product|Product} to delete can neither be a * {@link protos.google.cloud.retail.v2.Product.Type.COLLECTION|Product.Type.COLLECTION} * {@link protos.google.cloud.retail.v2.Product|Product} member nor a * {@link protos.google.cloud.retail.v2.Product.Type.PRIMARY|Product.Type.PRIMARY} * {@link protos.google.cloud.retail.v2.Product|Product} with more than one * {@link protos.google.cloud.retail.v2.Product.Type.VARIANT|variants}. Otherwise, an * INVALID_ARGUMENT error is returned. * * All inventory information for the named * {@link protos.google.cloud.retail.v2.Product|Product} will be deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.delete_product.js</caption> * region_tag:retail_v2_generated_ProductService_DeleteProduct_async */ deleteProduct(request?: protos.google.cloud.retail.v2.IDeleteProductRequest, options?: CallOptions): Promise<[ protos.google.protobuf.IEmpty, protos.google.cloud.retail.v2.IDeleteProductRequest | undefined, {} | undefined ]>; deleteProduct(request: protos.google.cloud.retail.v2.IDeleteProductRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, {} | null | undefined>): void; deleteProduct(request: protos.google.cloud.retail.v2.IDeleteProductRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.retail.v2.IDeleteProductRequest | null | undefined, {} | null | undefined>): void; /** * Permanently deletes all selected {@link protos.google.cloud.retail.v2.Product|Product}s * under a branch. * * This process is asynchronous. If the request is valid, the removal will be * enqueued and processed offline. Depending on the number of * {@link protos.google.cloud.retail.v2.Product|Product}s, this operation could take hours * to complete. Before the operation completes, some * {@link protos.google.cloud.retail.v2.Product|Product}s may still be returned by * {@link protos.google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} * or * {@link protos.google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * Depending on the number of {@link protos.google.cloud.retail.v2.Product|Product}s, this * operation could take hours to complete. To get a sample of * {@link protos.google.cloud.retail.v2.Product|Product}s that would be deleted, set * {@link protos.google.cloud.retail.v2.PurgeProductsRequest.force|PurgeProductsRequest.force} * to false. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. The resource name of the branch under which the products are * created. The format is * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` * @param {string} request.filter * Required. The filter string to specify the products to be deleted with a * length limit of 5,000 characters. * * Empty string filter is not allowed. "*" implies delete all items in a * branch. * * The eligible fields for filtering are: * * * `availability`: Double quoted * {@link protos.google.cloud.retail.v2.Product.availability|Product.availability} string. * * `create_time` : in ISO 8601 "zulu" format. * * Supported syntax: * * * Comparators (">", "<", ">=", "<=", "="). * Examples: * * create_time <= "2015-02-13T17:05:46Z" * * availability = "IN_STOCK" * * * Conjunctions ("AND") * Examples: * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" * * * Disjunctions ("OR") * Examples: * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" * * * Can support nested queries. * Examples: * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") * * * Filter Limits: * * Filter should not contain more than 6 conditions. * * Max nesting depth should not exceed 2 levels. * * Examples queries: * * Delete back order products created before a timestamp. * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" * @param {boolean} request.force * Actually perform the purge. * If `force` is set to false, the method will return the expected purge count * without deleting any products. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.purge_products.js</caption> * region_tag:retail_v2_generated_ProductService_PurgeProducts_async */ purgeProducts(request?: protos.google.cloud.retail.v2.IPurgeProductsRequest, options?: CallOptions): Promise<[ LROperation<protos.google.cloud.retail.v2.IPurgeProductsResponse, protos.google.cloud.retail.v2.IPurgeProductsMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>; purgeProducts(request: protos.google.cloud.retail.v2.IPurgeProductsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.IPurgeProductsResponse, protos.google.cloud.retail.v2.IPurgeProductsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; purgeProducts(request: protos.google.cloud.retail.v2.IPurgeProductsRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.IPurgeProductsResponse, protos.google.cloud.retail.v2.IPurgeProductsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; /** * Check the status of the long running operation returned by `purgeProducts()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.purge_products.js</caption> * region_tag:retail_v2_generated_ProductService_PurgeProducts_async */ checkPurgeProductsProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.PurgeProductsResponse, protos.google.cloud.retail.v2.PurgeProductsMetadata>>; /** * Bulk import of multiple {@link protos.google.cloud.retail.v2.Product|Product}s. * * Request processing may be synchronous. * Non-existing items are created. * * Note that it is possible for a subset of the * {@link protos.google.cloud.retail.v2.Product|Product}s to be successfully updated. * * @param {Object} request * The request object that will be sent. * @param {string} request.parent * Required. * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` * * If no updateMask is specified, requires products.create permission. * If updateMask is specified, requires products.update permission. * @param {string} request.requestId * Deprecated. This field has no effect. * @param {google.cloud.retail.v2.ProductInputConfig} request.inputConfig * Required. The desired input location of the data. * @param {google.cloud.retail.v2.ImportErrorsConfig} request.errorsConfig * The desired location of errors incurred during the Import. * @param {google.protobuf.FieldMask} request.updateMask * Indicates which fields in the provided imported `products` to update. If * not set, all fields are updated. If provided, only the existing product * fields are updated. Missing products will not be created. * @param {google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode} request.reconciliationMode * The mode of reconciliation between existing products and the products to be * imported. Defaults to * {@link protos.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. * @param {string} request.notificationPubsubTopic * Full Pub/Sub topic name for receiving notification. If this field is set, * when the import is finished, a notification is sent to * specified Pub/Sub topic. The message data is JSON string of a * {@link protos.google.longrunning.Operation|Operation}. * * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has * to be within the same project as * {@link protos.google.cloud.retail.v2.ImportProductsRequest.parent|ImportProductsRequest.parent}. * Make sure that both * `cloud-retail-customer-data-access@system.gserviceaccount.com` and * `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com` * have the `pubsub.topics.publish` IAM permission on the topic. * * Only supported when * {@link protos.google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} * is set to `FULL`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.import_products.js</caption> * region_tag:retail_v2_generated_ProductService_ImportProducts_async */ importProducts(request?: protos.google.cloud.retail.v2.IImportProductsRequest, options?: CallOptions): Promise<[ LROperation<protos.google.cloud.retail.v2.IImportProductsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>; importProducts(request: protos.google.cloud.retail.v2.IImportProductsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.IImportProductsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; importProducts(request: protos.google.cloud.retail.v2.IImportProductsRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.IImportProductsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; /** * Check the status of the long running operation returned by `importProducts()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.import_products.js</caption> * region_tag:retail_v2_generated_ProductService_ImportProducts_async */ checkImportProductsProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.ImportProductsResponse, protos.google.cloud.retail.v2.ImportMetadata>>; /** * Updates inventory information for a * {@link protos.google.cloud.retail.v2.Product|Product} while respecting the last update * timestamps of each inventory field. * * This process is asynchronous and does not require the * {@link protos.google.cloud.retail.v2.Product|Product} to exist before updating * fulfillment information. If the request is valid, the update is enqueued * and processed downstream. As a consequence, when a response is returned, * updates are not immediately manifested in the * {@link protos.google.cloud.retail.v2.Product|Product} queried by * {@link protos.google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} * or * {@link protos.google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * When inventory is updated with * {@link protos.google.cloud.retail.v2.ProductService.CreateProduct|ProductService.CreateProduct} * and * {@link protos.google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct}, * the specified inventory field value(s) overwrite any existing value(s) * while ignoring the last update time for this field. Furthermore, the last * update times for the specified inventory fields are overwritten by the * times of the * {@link protos.google.cloud.retail.v2.ProductService.CreateProduct|ProductService.CreateProduct} * or * {@link protos.google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} * request. * * If no inventory fields are set in * {@link protos.google.cloud.retail.v2.CreateProductRequest.product|CreateProductRequest.product}, * then any pre-existing inventory information for this product is used. * * If no inventory fields are set in * {@link protos.google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, * then any existing inventory information is preserved. * * Pre-existing inventory information can only be updated with * {@link protos.google.cloud.retail.v2.ProductService.SetInventory|ProductService.SetInventory}, * {@link protos.google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, * and * {@link protos.google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. * * The returned {@link protos.google.longrunning.Operation|Operation}s is obsolete after * one day, and the {@link protos.google.longrunning.Operations.GetOperation|GetOperation} * API returns `NOT_FOUND` afterwards. * * If conflicting updates are issued, the * {@link protos.google.longrunning.Operation|Operation}s associated with the stale * updates are not marked as {@link protos.google.longrunning.Operation.done|done} until * they are obsolete. * * @param {Object} request * The request object that will be sent. * @param {google.cloud.retail.v2.Product} request.inventory * Required. The inventory information to update. The allowable fields to * update are: * * * {@link protos.google.cloud.retail.v2.Product.price_info|Product.price_info} * * {@link protos.google.cloud.retail.v2.Product.availability|Product.availability} * * {@link protos.google.cloud.retail.v2.Product.available_quantity|Product.available_quantity} * * {@link protos.google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info} * The updated inventory fields must be specified in * {@link protos.google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. * * If * {@link protos.google.cloud.retail.v2.Product.name|SetInventoryRequest.inventory.name} * is empty or invalid, an INVALID_ARGUMENT error is returned. * * If the caller does not have permission to update the * {@link protos.google.cloud.retail.v2.Product|Product} named in * {@link protos.google.cloud.retail.v2.Product.name|Product.name}, regardless of whether * or not it exists, a PERMISSION_DENIED error is returned. * * If the {@link protos.google.cloud.retail.v2.Product|Product} to update does not have * existing inventory information, the provided inventory information will be * inserted. * * If the {@link protos.google.cloud.retail.v2.Product|Product} to update has existing * inventory information, the provided inventory information will be merged * while respecting the last update time for each inventory field, using the * provided or default value for * {@link protos.google.cloud.retail.v2.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. * * The caller can replace place IDs for a subset of fulfillment types in the * following ways: * * * Adds "fulfillment_info" in * {@link protos.google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types and corresponding place IDs * to update in * {@link protos.google.cloud.retail.v2.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * The caller can clear all place IDs from a subset of fulfillment types in * the following ways: * * * Adds "fulfillment_info" in * {@link protos.google.cloud.retail.v2.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} * * Specifies only the desired fulfillment types to clear in * {@link protos.google.cloud.retail.v2.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} * * Checks that only the desired fulfillment info types have empty * {@link protos.google.cloud.retail.v2.FulfillmentInfo.place_ids|SetInventoryRequest.inventory.fulfillment_info.place_ids} * * The last update time is recorded for the following inventory fields: * * {@link protos.google.cloud.retail.v2.Product.price_info|Product.price_info} * * {@link protos.google.cloud.retail.v2.Product.availability|Product.availability} * * {@link protos.google.cloud.retail.v2.Product.available_quantity|Product.available_quantity} * * {@link protos.google.cloud.retail.v2.Product.fulfillment_info|Product.fulfillment_info} * * If a full overwrite of inventory information while ignoring timestamps is * needed, * {@link protos.google.cloud.retail.v2.ProductService.UpdateProduct|ProductService.UpdateProduct} * should be invoked instead. * @param {google.protobuf.FieldMask} request.setMask * Indicates which inventory fields in the provided * {@link protos.google.cloud.retail.v2.Product|Product} to update. * * At least one field must be provided. * * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error * is returned and the entire update will be ignored. * @param {google.protobuf.Timestamp} request.setTime * The time when the request is issued, used to prevent * out-of-order updates on inventory fields with the last update time * recorded. If not provided, the internal system time will be used. * @param {boolean} request.allowMissing * If set to true, and the {@link protos.google.cloud.retail.v2.Product|Product} with name * {@link protos.google.cloud.retail.v2.Product.name|Product.name} is not found, the * inventory update will still be processed and retained for at most 1 day * until the {@link protos.google.cloud.retail.v2.Product|Product} is created. If set to * false, a NOT_FOUND error is returned if the * {@link protos.google.cloud.retail.v2.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.set_inventory.js</caption> * region_tag:retail_v2_generated_ProductService_SetInventory_async */ setInventory(request?: protos.google.cloud.retail.v2.ISetInventoryRequest, options?: CallOptions): Promise<[ LROperation<protos.google.cloud.retail.v2.ISetInventoryResponse, protos.google.cloud.retail.v2.ISetInventoryMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>; setInventory(request: protos.google.cloud.retail.v2.ISetInventoryRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.ISetInventoryResponse, protos.google.cloud.retail.v2.ISetInventoryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; setInventory(request: protos.google.cloud.retail.v2.ISetInventoryRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.ISetInventoryResponse, protos.google.cloud.retail.v2.ISetInventoryMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; /** * Check the status of the long running operation returned by `setInventory()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.set_inventory.js</caption> * region_tag:retail_v2_generated_ProductService_SetInventory_async */ checkSetInventoryProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.SetInventoryResponse, protos.google.cloud.retail.v2.SetInventoryMetadata>>; /** * We recommend that you use the * {@link protos.google.cloud.retail.v2.ProductService.AddLocalInventories|ProductService.AddLocalInventories} * method instead of the * {@link protos.google.cloud.retail.v2.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces} * method. * {@link protos.google.cloud.retail.v2.ProductService.AddLocalInventories|ProductService.AddLocalInventories} * achieves the same results but provides more fine-grained control over * ingesting local inventory data. * * Incrementally adds place IDs to * {@link protos.google.cloud.retail.v2.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. * * This process is asynchronous and does not require the * {@link protos.google.cloud.retail.v2.Product|Product} to exist before updating * fulfillment information. If the request is valid, the update will be * enqueued and processed downstream. As a consequence, when a response is * returned, the added place IDs are not immediately manifested in the * {@link protos.google.cloud.retail.v2.Product|Product} queried by * {@link protos.google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} * or * {@link protos.google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} * API will return NOT_FOUND afterwards. * * If conflicting updates are issued, the * {@link protos.google.longrunning.Operation|Operation}s associated with the stale * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} * until being obsolete. * * @param {Object} request * The request object that will be sent. * @param {string} request.product * Required. Full resource name of {@link protos.google.cloud.retail.v2.Product|Product}, * such as * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to access the * {@link protos.google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * @param {string} request.type * Required. The fulfillment type, including commonly used types (such as * pickup in store and same day delivery), and custom types. * * Supported values: * * * "pickup-in-store" * * "ship-to-store" * * "same-day-delivery" * * "next-day-delivery" * * "custom-type-1" * * "custom-type-2" * * "custom-type-3" * * "custom-type-4" * * "custom-type-5" * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * * This field directly corresponds to * {@link protos.google.cloud.retail.v2.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type}, such as * the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery" to be added for this * {@link protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type}. Duplicate * IDs will be automatically ignored. * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 10 characters, matching * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an * INVALID_ARGUMENT error is returned. * * If the total number of place IDs exceeds 2000 for this * {@link protos.google.cloud.retail.v2.AddFulfillmentPlacesRequest.type|type} after * adding, then the update will be rejected. * @param {google.protobuf.Timestamp} request.addTime * The time when the fulfillment updates are issued, used to prevent * out-of-order updates on fulfillment information. If not provided, the * internal system time will be used. * @param {boolean} request.allowMissing * If set to true, and the {@link protos.google.cloud.retail.v2.Product|Product} is not * found, the fulfillment information will still be processed and retained for * at most 1 day and processed once the * {@link protos.google.cloud.retail.v2.Product|Product} is created. If set to false, a * NOT_FOUND error is returned if the * {@link protos.google.cloud.retail.v2.Product|Product} is not found. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing * a long running operation. Its `promise()` method returns a promise * you can `await` for. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.add_fulfillment_places.js</caption> * region_tag:retail_v2_generated_ProductService_AddFulfillmentPlaces_async */ addFulfillmentPlaces(request?: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, options?: CallOptions): Promise<[ LROperation<protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>; addFulfillmentPlaces(request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; addFulfillmentPlaces(request: protos.google.cloud.retail.v2.IAddFulfillmentPlacesRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.IAddFulfillmentPlacesResponse, protos.google.cloud.retail.v2.IAddFulfillmentPlacesMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void; /** * Check the status of the long running operation returned by `addFulfillmentPlaces()`. * @param {String} name * The operation name that will be passed. * @returns {Promise} - The promise which resolves to an object. * The decoded operation object has result and metadata field to get information from. * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } * for more details and examples. * @example <caption>include:samples/generated/v2/product_service.add_fulfillment_places.js</caption> * region_tag:retail_v2_generated_ProductService_AddFulfillmentPlaces_async */ checkAddFulfillmentPlacesProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.AddFulfillmentPlacesResponse, protos.google.cloud.retail.v2.AddFulfillmentPlacesMetadata>>; /** * We recommend that you use the * {@link protos.google.cloud.retail.v2.ProductService.RemoveLocalInventories|ProductService.RemoveLocalInventories} * method instead of the * {@link protos.google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces} * method. * {@link protos.google.cloud.retail.v2.ProductService.RemoveLocalInventories|ProductService.RemoveLocalInventories} * achieves the same results but provides more fine-grained control over * ingesting local inventory data. * * Incrementally removes place IDs from a * {@link protos.google.cloud.retail.v2.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. * * This process is asynchronous and does not require the * {@link protos.google.cloud.retail.v2.Product|Product} to exist before updating * fulfillment information. If the request is valid, the update will be * enqueued and processed downstream. As a consequence, when a response is * returned, the removed place IDs are not immediately manifested in the * {@link protos.google.cloud.retail.v2.Product|Product} queried by * {@link protos.google.cloud.retail.v2.ProductService.GetProduct|ProductService.GetProduct} * or * {@link protos.google.cloud.retail.v2.ProductService.ListProducts|ProductService.ListProducts}. * * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} * API will return NOT_FOUND afterwards. * * If conflicting updates are issued, the * {@link protos.google.longrunning.Operation|Operation}s associated with the stale * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} * until being obsolete. * * @param {Object} request * The request object that will be sent. * @param {string} request.product * Required. Full resource name of {@link protos.google.cloud.retail.v2.Product|Product}, * such as * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. * * If the caller does not have permission to access the * {@link protos.google.cloud.retail.v2.Product|Product}, regardless of whether or not it * exists, a PERMISSION_DENIED error is returned. * @param {string} request.type * Required. The fulfillment type, including commonly used types (such as * pickup in store and same day delivery), and custom types. * * Supported values: * * * "pickup-in-store" * * "ship-to-store" * * "same-day-delivery" * * "next-day-delivery" * * "custom-type-1" * * "custom-type-2" * * "custom-type-3" * * "custom-type-4" * * "custom-type-5" * * If this field is set to an invalid value other than these, an * INVALID_ARGUMENT error is returned. * * This field directly corresponds to * {@link protos.google.cloud.retail.v2.FulfillmentInfo.type|Product.fulfillment_info.type}. * @param {string[]} request.placeIds * Required. The IDs for this * {@link protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type|type}, such as * the store IDs for "pickup-in-store" or the region IDs for * "same-day-delivery", to be removed for this * {@link protos.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type|type}. * * At least 1 value is required, and a maximum of 2000 values are allowed. * Each value must be a string with a length limit of 1