Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
ProductSearch GA (#280)
Browse files Browse the repository at this point in the history
* ProductSearch GA

* ProductSearch GA
  • Loading branch information
nirupa-kumar authored Nov 29, 2018
1 parent e224ace commit 60a81ee
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
async function importProductSets(projectId, location, gcsUri) {
// Imports the Google Cloud client library
// [START vision_product_search_tutorial_import]
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
// [END vision_product_search_tutorial_import]
// Creates a client
const client = new vision.ProductSearchClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function addProductToProductSet(
) {
// [START vision_product_search_add_product_to_product_set]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand Down Expand Up @@ -55,7 +55,7 @@ async function addProductToProductSet(
async function listProductsInProductSet(projectId, location, productSetId) {
// [START vision_product_search_list_products_in_product_set]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand Down Expand Up @@ -90,7 +90,7 @@ async function removeProductFromProductSet(
) {
// [START vision_product_search_remove_product_from_product_set]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function createProductSet(
) {
// [START vision_product_search_create_product_set]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down Expand Up @@ -57,7 +57,7 @@ async function createProductSet(
async function getProductSet(projectId, location, productSetId) {
// [START vision_product_search_get_product_set]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down Expand Up @@ -85,7 +85,7 @@ async function getProductSet(projectId, location, productSetId) {
async function listProductSets(projectId, location) {
// [START vision_product_search_list_product_sets]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand All @@ -110,7 +110,7 @@ async function listProductSets(projectId, location) {
async function deleteProductSet(projectId, location, productSetId) {
// [START vision_product_search_delete_product_set]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function createProduct(
) {
// [START vision_product_search_create_product]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down Expand Up @@ -60,7 +60,7 @@ async function createProduct(
async function getProduct(projectId, location, productId) {
// [START vision_product_search_get_product]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down Expand Up @@ -88,7 +88,7 @@ async function getProduct(projectId, location, productId) {
async function listProducts(projectId, location) {
// [START vision_product_search_list_products]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down Expand Up @@ -122,7 +122,7 @@ async function listProducts(projectId, location) {
async function deleteProduct(projectId, location, productId) {
// [START vision_product_search_delete_product]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand All @@ -145,7 +145,7 @@ async function deleteProduct(projectId, location, productId) {
async function updateProductLabels(projectId, location, productId, key, value) {
// [START vision_product_search_update_product_labels]
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

// Creates a client
const client = new vision.ProductSearchClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function createReferenceImage(
) {
// [START vision_product_search_create_reference_image]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand Down Expand Up @@ -58,7 +58,7 @@ async function createReferenceImage(
async function listReferenceImage(projectId, location, productId) {
// [START vision_product_search_list_reference_images]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand Down Expand Up @@ -91,7 +91,7 @@ async function getReferenceImage(
) {
// [START vision_product_search_get_reference_image]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand All @@ -103,7 +103,7 @@ async function getReferenceImage(
// const productId = 'Id of the product';
// const referenceImageId = 'Id of the reference image';

const formattedName = client.referenceImagePath(
const formattedName = client.imagePath(
projectId,
location,
productId,
Expand All @@ -128,7 +128,7 @@ async function deleteReferenceImage(
) {
// [START vision_product_search_delete_reference_image]

const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');

const client = new vision.ProductSearchClient();

Expand All @@ -140,7 +140,7 @@ async function deleteReferenceImage(
// const productId = 'Id of the product';
// const referenceImageId = 'Id of the reference image';

const formattedName = client.referenceImagePath(
const formattedName = client.imagePath(
projectId,
location,
productId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function getSimilarProductsFile(
filter
) {
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
const fs = require('fs');
// Creates a client
const productSearchClient = new vision.ProductSearchClient();
Expand Down Expand Up @@ -87,7 +87,7 @@ async function getSimilarProductsGcs(
filter
) {
// Imports the Google Cloud client library
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
// Creates a client
const productSearchClient = new vision.ProductSearchClient();
const imageAnnotatorClient = new vision.ImageAnnotatorClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
const path = require(`path`);
const assert = require('assert');
const tools = require(`@google-cloud/nodejs-repo-tools`);
const cmd = `node importProductSets.v1p3beta1.js`;
const cmd = `node importProductSets.js`;
const cwd = path.join(__dirname, `..`, `productSearch`);

//Shared fixture data for product tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

const path = require(`path`);
const uuid = require(`uuid`);
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
const productSearchClient = new vision.ProductSearchClient();
const assert = require('assert');
const tools = require(`@google-cloud/nodejs-repo-tools`);
const cmd = `node productSearch.v1p3beta1.js`;
const cmd = `node productSearch.js`;
const cwd = path.join(__dirname, `..`, `productSearch`);

// Shared fixture data for product tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

const path = require(`path`);
const uuid = require(`uuid`);
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
const productSearch = new vision.ProductSearchClient();
const assert = require('assert');
const tools = require(`@google-cloud/nodejs-repo-tools`);
const cmd = `node productSets.v1p3beta1.js`;
const cmd = `node productSets.js`;
const cwd = path.join(__dirname, `..`, `productSearch`);

// Shared fixture data for product tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

const path = require(`path`);
const uuid = require(`uuid`);
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
const productSearch = new vision.ProductSearchClient();
const assert = require('assert');
const tools = require(`@google-cloud/nodejs-repo-tools`);
const cmd = `node products.v1p3beta1.js`;
const cmd = `node products.js`;
const cwd = path.join(__dirname, `..`, `productSearch`);

// Shared fixture data for product tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

const path = require(`path`);
const uuid = require(`uuid`);
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
const productSearchClient = new vision.ProductSearchClient();
const assert = require('assert');
const tools = require(`@google-cloud/nodejs-repo-tools`);
const cmd = `node referenceImages.v1p3beta1.js`;
const cmd = `node referenceImages.js`;
const cwd = path.join(__dirname, `..`, `productSearch`);

// Shared fixture data for product tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
'use strict';

const path = require(`path`);
const vision = require('@google-cloud/vision').v1p3beta1;
const vision = require('@google-cloud/vision');
const productSearch = new vision.ProductSearchClient();
const assert = require('assert');
const tools = require(`@google-cloud/nodejs-repo-tools`);
const cmd = `node similarProducts.v1p3beta1.js`;
const cmd = `node similarProducts.js`;
const cwd = path.join(__dirname, `..`, `productSearch`);
const filter = ['', 'style=womens'];
const localPath = './../resources/shoes_1.jpg';
const gcsUri = 'gs://nodejs-docs-samples/product-search/shoes_1.jpg';

// Shared fixture data for product tests
//Need to have a product set already imported and indexed
// (gs://nodejs-docs-samples/product-search/indexed_product_set.csv)
// (gs://nodejs-docs-samples/product-search/indexed_product_sets.csv)
const testSimilarProducts = {
projectId: process.env.GCLOUD_PROJECT,
location: 'us-west1',
Expand Down

0 comments on commit 60a81ee

Please sign in to comment.