Class v1p4beta1.ProductSearchClient (4.3.2)

Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:

  • The API has a collection of ProductSet resources, named projects/* /locations/* /productSets/*, which acts as a way to put different products into groups to limit identification.

In parallel,

  • The API has a collection of resources, named projects/* /locations/* /products/*

  • Each has a collection of ReferenceImage resources, named projects/* /locations/* /products/* /referenceImages/* v1p4beta1

Package

@google-cloud/vision

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of ProductSearchClient.

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 ProductSearchClient({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;
    };

operationsClient

operationsClient: gax.OperationsClient;

pathTemplates

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

port

static get port(): number;

The port for this API service.

productSearchStub

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

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

addProductToProductSet(request, options)

addProductToProductSet(request?: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest | undefined),
        {} | undefined
    ]>;

Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

One Product can be added to at most 100 ProductSets.

Possible errors:

* Returns NOT_FOUND if the Product or the ProductSet doesn't exist.

Parameters
Name Description
request IAddProductToProductSetRequest

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.cloud.vision.v1p4beta1.IAddProductToProductSetRequest | 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 resource name for the ProductSet to modify.
   *  Format is:
   *  `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
   */
  // const name = 'abc123'
  /**
   *  Required. The resource name for the Product to be added to this ProductSet.
   *  Format is:
   *  `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
   */
  // const product = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.addProductToProductSet(request);
    console.log(response);
  }

  callAddProductToProductSet();

addProductToProductSet(request, options, callback)

addProductToProductSet(request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAddProductToProductSetRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

addProductToProductSet(request, callback)

addProductToProductSet(request: protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAddProductToProductSetRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

checkImportProductSetsProgress(name)

checkImportProductSetsProgress(name: string): Promise<LROperation<protos.google.cloud.vision.v1p4beta1.ImportProductSetsResponse, protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata>>;

Check the status of the long running operation returned by importProductSets().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.vision.v1p4beta1.ImportProductSetsResponse, protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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 project in which the ProductSets should be imported.
   *  Format is `projects/PROJECT_ID/locations/LOC_ID`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The input content for the list of requests.
   */
  // const inputConfig = {}

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const [operation] = await visionClient.importProductSets(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportProductSets();

checkPurgeProductsProgress(name)

checkPurgeProductsProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata>>;

Check the status of the long running operation returned by purgeProducts().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.protobuf.Empty, protos.google.cloud.vision.v1p4beta1.BatchOperationMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. 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.
   */
  /**
   *  Specify which ProductSet contains the Products to be deleted.
   */
  // const productSetPurgeConfig = {}
  /**
   *  If delete_orphan_products is true, all Products that are not in any
   *  ProductSet will be deleted.
   */
  // const deleteOrphanProducts = true
  /**
   *  Required. The project and location in which the Products should be deleted.
   *  Format is `projects/PROJECT_ID/locations/LOC_ID`.
   */
  // const parent = 'abc123'
  /**
   *  The default value is false. Override this value to true to actually perform
   *  the purge.
   */
  // const force = true

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const [operation] = await visionClient.purgeProducts(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callPurgeProducts();

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.

createProduct(request, options)

createProduct(request?: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, options?: CallOptions): Promise<[
        protos.google.cloud.vision.v1p4beta1.IProduct,
        protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | undefined,
        {} | undefined
    ]>;

Creates and returns a new product resource.

Possible errors:

* Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. * Returns INVALID_ARGUMENT if description is longer than 4096 characters. * Returns INVALID_ARGUMENT if product_category is missing or invalid.

Parameters
Name Description
request ICreateProductRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | 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 project in which the Product should be created.
   *  Format is
   *  `projects/PROJECT_ID/locations/LOC_ID`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The product to create.
   */
  // const product = {}
  /**
   *  A user-supplied resource id for this Product. If set, the server will
   *  attempt to use this value as the resource id. If it is already in use, an
   *  error is returned with code ALREADY_EXISTS. Must be at most 128 characters
   *  long. It cannot contain the character `/`.
   */
  // const productId = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.createProduct(request);
    console.log(response);
  }

  callCreateProduct();

createProduct(request, options, callback)

createProduct(request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, options: CallOptions, callback: Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateProductRequest
options CallOptions
callback Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createProduct(request, callback)

createProduct(request: protos.google.cloud.vision.v1p4beta1.ICreateProductRequest, callback: Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateProductRequest
callback Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.ICreateProductRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createProductSet(request, options)

createProductSet(request?: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.vision.v1p4beta1.IProductSet,
        protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | undefined,
        {} | undefined
    ]>;

Creates and returns a new ProductSet resource.

Possible errors:

* Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.

Parameters
Name Description
request ICreateProductSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.vision.v1p4beta1.IProductSet, protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ProductSet. 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 project in which the ProductSet should be created.
   *  Format is `projects/PROJECT_ID/locations/LOC_ID`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The ProductSet to create.
   */
  // const productSet = {}
  /**
   *  A user-supplied resource id for this ProductSet. If set, the server will
   *  attempt to use this value as the resource id. If it is already in use, an
   *  error is returned with code ALREADY_EXISTS. Must be at most 128 characters
   *  long. It cannot contain the character `/`.
   */
  // const productSetId = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.createProductSet(request);
    console.log(response);
  }

  callCreateProductSet();

createProductSet(request, options, callback)

createProductSet(request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, options: CallOptions, callback: Callback<protos.google.cloud.vision.v1p4beta1.IProductSet, protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateProductSetRequest
options CallOptions
callback Callback<protos.google.cloud.vision.v1p4beta1.IProductSet, protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createProductSet(request, callback)

createProductSet(request: protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, callback: Callback<protos.google.cloud.vision.v1p4beta1.IProductSet, protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateProductSetRequest
callback Callback<protos.google.cloud.vision.v1p4beta1.IProductSet, protos.google.cloud.vision.v1p4beta1.ICreateProductSetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createReferenceImage(request, options)

createReferenceImage(request?: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, options?: CallOptions): Promise<[
        protos.google.cloud.vision.v1p4beta1.IReferenceImage,
        (protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest | undefined),
        {} | undefined
    ]>;

Creates and returns a new ReferenceImage resource.

The bounding_poly field is optional. If bounding_poly is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.

Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).

Possible errors:

* Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. * Returns INVALID_ARGUMENT if the product does not exist. * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.

Parameters
Name Description
request ICreateReferenceImageRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.vision.v1p4beta1.IReferenceImage, (protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ReferenceImage. 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. Resource name of the product in which to create the reference
   *  image.
   *  Format is
   *  `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The reference image to create.
   *  If an image ID is specified, it is ignored.
   */
  // const referenceImage = {}
  /**
   *  A user-supplied resource id for the ReferenceImage to be added. If set,
   *  the server will attempt to use this value as the resource id. If it is
   *  already in use, an error is returned with code ALREADY_EXISTS. Must be at
   *  most 128 characters long. It cannot contain the character `/`.
   */
  // const referenceImageId = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.createReferenceImage(request);
    console.log(response);
  }

  callCreateReferenceImage();

createReferenceImage(request, options, callback)

createReferenceImage(request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, options: CallOptions, callback: Callback<protos.google.cloud.vision.v1p4beta1.IReferenceImage, protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateReferenceImageRequest
options CallOptions
callback Callback<protos.google.cloud.vision.v1p4beta1.IReferenceImage, protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createReferenceImage(request, callback)

createReferenceImage(request: protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, callback: Callback<protos.google.cloud.vision.v1p4beta1.IReferenceImage, protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateReferenceImageRequest
callback Callback<protos.google.cloud.vision.v1p4beta1.IReferenceImage, protos.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteProduct(request, options)

deleteProduct(request?: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | undefined,
        {} | undefined
    ]>;

Permanently deletes a product and its reference images.

Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

Parameters
Name Description
request IDeleteProductRequest

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.cloud.vision.v1p4beta1.IDeleteProductRequest | 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. Resource name of product to delete.
   *  Format is:
   *  `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
   */
  // const name = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.deleteProduct(request);
    console.log(response);
  }

  callDeleteProduct();

deleteProduct(request, options, callback)

deleteProduct(request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteProductRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteProduct(request, callback)

deleteProduct(request: protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteProductRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteProductSet(request, options)

deleteProductSet(request?: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | undefined,
        {} | undefined
    ]>;

Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

The actual image files are not deleted from Google Cloud Storage.

Parameters
Name Description
request IDeleteProductSetRequest

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.cloud.vision.v1p4beta1.IDeleteProductSetRequest | 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. Resource name of the ProductSet to delete.
   *  Format is:
   *  `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
   */
  // const name = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.deleteProductSet(request);
    console.log(response);
  }

  callDeleteProductSet();

deleteProductSet(request, options, callback)

deleteProductSet(request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteProductSetRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteProductSet(request, callback)

deleteProductSet(request: protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteProductSetRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteReferenceImage(request, options)

deleteReferenceImage(request?: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest | undefined),
        {} | undefined
    ]>;

Permanently deletes a reference image.

The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.

The actual image files are not deleted from Google Cloud Storage.

Parameters
Name Description
request IDeleteReferenceImageRequest

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.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest | 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 resource name of the reference image to delete.
   *  Format is:
   *  `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
   */
  // const name = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.deleteReferenceImage(request);
    console.log(response);
  }

  callDeleteReferenceImage();

deleteReferenceImage(request, options, callback)

deleteReferenceImage(request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteReferenceImageRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteReferenceImage(request, callback)

deleteReferenceImage(request: protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteReferenceImageRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProduct(request, options)

getProduct(request?: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, options?: CallOptions): Promise<[
        protos.google.cloud.vision.v1p4beta1.IProduct,
        protos.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined,
        {} | undefined
    ]>;

Gets information associated with a Product.

Possible errors:

* Returns NOT_FOUND if the Product does not exist.

Parameters
Name Description
request IGetProductRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.IGetProductRequest | 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. Resource name of the Product to get.
   *  Format is:
   *  `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
   */
  // const name = 'abc123'

  // Imports the Vision library
  const {ProductSearchClient} = require('@google-cloud/vision').v1p4beta1;

  // Instantiates a client
  const visionClient = new ProductSearchClient();

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

    // Run request
    const response = await visionClient.getProduct(request);
    console.log(response);
  }

  callGetProduct();

getProduct(request, options, callback)

getProduct(request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, options: CallOptions, callback: Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.IGetProductRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetProductRequest
options CallOptions
callback Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.IGetProductRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProduct(request, callback)

getProduct(request: protos.google.cloud.vision.v1p4beta1.IGetProductRequest, callback: Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.IGetProductRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetProductRequest
callback Callback<protos.google.cloud.vision.v1p4beta1.IProduct, protos.google.cloud.vision.v1p4beta1.IGetProductRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProductSet(request, options)

getProductSet(request?: protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest, options?: CallOptions): Promise<[
        protos.google.cloud.vision.v1p4beta1.IProductSet,
        protos.google.cloud.vision.v1p4beta1.IGetProductSetRequest | undefined,
        {} | undefined
    ]>;

Gets information associated with a ProductSet.

Possible errors:

* Returns NOT_FOUND if the ProductSet does not exist.

Parameters
Name Description
request IGetProductSetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description</