From a512e30bec2ff219505a9ab281807442696c807b Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Mon, 17 Dec 2018 04:11:29 -0800 Subject: [PATCH 1/2] [CHANGE ME] Re-generated to pick up changes in the API or client library generator. --- .../cloud/vision/v1/image_annotator.proto | 1 + .../vision/v1/product_search_service.proto | 4 +- .../cloud/vision/v1/text_annotation.proto | 6 +- .../cloud/vision/v1/doc_text_annotation.js | 6 +- src/v1/product_search_client.js | 164 +++++++++--------- synth.metadata | 69 ++++++++ test/gapic-v1.js | 16 +- 7 files changed, 172 insertions(+), 94 deletions(-) create mode 100644 synth.metadata diff --git a/protos/google/cloud/vision/v1/image_annotator.proto b/protos/google/cloud/vision/v1/image_annotator.proto index a7235f7a..1f768c20 100644 --- a/protos/google/cloud/vision/v1/image_annotator.proto +++ b/protos/google/cloud/vision/v1/image_annotator.proto @@ -23,6 +23,7 @@ import "google/cloud/vision/v1/product_search.proto"; import "google/cloud/vision/v1/text_annotation.proto"; import "google/cloud/vision/v1/web_detection.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; import "google/type/color.proto"; diff --git a/protos/google/cloud/vision/v1/product_search_service.proto b/protos/google/cloud/vision/v1/product_search_service.proto index f8ae08e3..d017d27f 100644 --- a/protos/google/cloud/vision/v1/product_search_service.proto +++ b/protos/google/cloud/vision/v1/product_search_service.proto @@ -99,8 +99,8 @@ service ProductSearch { }; } - // Permanently deletes a ProductSet. All Products and ReferenceImages in the - // ProductSet will be deleted. + // Permanently deletes a ProductSet. Products and ReferenceImages in the + // ProductSet are not deleted. // // The actual image files are not deleted from Google Cloud Storage. // diff --git a/protos/google/cloud/vision/v1/text_annotation.proto b/protos/google/cloud/vision/v1/text_annotation.proto index c66c9114..44ebcdae 100644 --- a/protos/google/cloud/vision/v1/text_annotation.proto +++ b/protos/google/cloud/vision/v1/text_annotation.proto @@ -159,7 +159,7 @@ message Block { // | | // 1----0 // - // and the vertice order will still be (0, 1, 2, 3). + // and the vertex order will still be (0, 1, 2, 3). BoundingPoly bounding_box = 2; // List of paragraphs in this block (if this blocks is of type text). @@ -191,7 +191,7 @@ message Paragraph { // 2----3 // | | // 1----0 - // and the vertice order will still be (0, 1, 2, 3). + // and the vertex order will still be (0, 1, 2, 3). BoundingPoly bounding_box = 2; // List of words in this paragraph. @@ -220,7 +220,7 @@ message Word { // 2----3 // | | // 1----0 - // and the vertice order will still be (0, 1, 2, 3). + // and the vertex order will still be (0, 1, 2, 3). BoundingPoly bounding_box = 2; // List of symbols in the word. diff --git a/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js b/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js index e42ed35d..6ebd6432 100644 --- a/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js +++ b/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js @@ -199,7 +199,7 @@ const Page = { * | | * 1----0 * - * and the vertice order will still be (0, 1, 2, 3). + * and the vertex order will still be (0, 1, 2, 3). * * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} * @@ -286,7 +286,7 @@ const Block = { * 2----3 * | | * 1----0 - * and the vertice order will still be (0, 1, 2, 3). + * and the vertex order will still be (0, 1, 2, 3). * * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} * @@ -329,7 +329,7 @@ const Paragraph = { * 2----3 * | | * 1----0 - * and the vertice order will still be (0, 1, 2, 3). + * and the vertex order will still be (0, 1, 2, 3). * * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} * diff --git a/src/v1/product_search_client.js b/src/v1/product_search_client.js index 6a611c34..614a8336 100644 --- a/src/v1/product_search_client.js +++ b/src/v1/product_search_client.js @@ -117,14 +117,14 @@ class ProductSearchClient { locationPathTemplate: new gax.PathTemplate( 'projects/{project}/locations/{location}' ), - productPathTemplate: new gax.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), productSetPathTemplate: new gax.PathTemplate( 'projects/{project}/locations/{location}/productSets/{product_set}' ), - imagePathTemplate: new gax.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{image}' + productPathTemplate: new gax.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + referenceImagePathTemplate: new gax.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' ), }; @@ -881,7 +881,7 @@ class ProductSearchClient { * // optional auth parameters. * }); * - * const formattedName = client.imagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); * client.getReferenceImage({name: formattedName}) * .then(responses => { * const response = responses[0]; @@ -938,7 +938,7 @@ class ProductSearchClient { * // optional auth parameters. * }); * - * const formattedName = client.imagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); * client.deleteReferenceImage({name: formattedName}).catch(err => { * console.error(err); * }); @@ -1376,8 +1376,8 @@ class ProductSearchClient { } /** - * Permanently deletes a ProductSet. All Products and ReferenceImages in the - * ProductSet will be deleted. + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. * * The actual image files are not deleted from Google Cloud Storage. * @@ -1844,52 +1844,52 @@ class ProductSearchClient { } /** - * Return a fully-qualified product resource name string. + * Return a fully-qualified product_set resource name string. * * @param {String} project * @param {String} location - * @param {String} product + * @param {String} productSet * @returns {String} */ - productPath(project, location, product) { - return this._pathTemplates.productPathTemplate.render({ + productSetPath(project, location, productSet) { + return this._pathTemplates.productSetPathTemplate.render({ project: project, location: location, - product: product, + product_set: productSet, }); } /** - * Return a fully-qualified product_set resource name string. + * Return a fully-qualified product resource name string. * * @param {String} project * @param {String} location - * @param {String} productSet + * @param {String} product * @returns {String} */ - productSetPath(project, location, productSet) { - return this._pathTemplates.productSetPathTemplate.render({ + productPath(project, location, product) { + return this._pathTemplates.productPathTemplate.render({ project: project, location: location, - product_set: productSet, + product: product, }); } /** - * Return a fully-qualified image resource name string. + * Return a fully-qualified reference_image resource name string. * * @param {String} project * @param {String} location * @param {String} product - * @param {String} image + * @param {String} referenceImage * @returns {String} */ - imagePath(project, location, product, image) { - return this._pathTemplates.imagePathTemplate.render({ + referenceImagePath(project, location, product, referenceImage) { + return this._pathTemplates.referenceImagePathTemplate.render({ project: project, location: location, product: product, - image: image, + reference_image: referenceImage, }); } @@ -1916,39 +1916,6 @@ class ProductSearchClient { .location; } - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the product. - */ - matchProductFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).product; - } - /** * Parse the productSetName from a product_set resource. * @@ -1986,47 +1953,88 @@ class ProductSearchClient { } /** - * Parse the imageName from a image resource. + * Parse the productName from a product resource. + * + * @param {String} productName + * A fully-qualified path representing a product resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromProductName(productName) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the productName from a product resource. + * + * @param {String} productName + * A fully-qualified path representing a product resources. + * @returns {String} - A string representing the location. + */ + matchLocationFromProductName(productName) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the productName from a product resource. + * + * @param {String} productName + * A fully-qualified path representing a product resources. + * @returns {String} - A string representing the product. + */ + matchProductFromProductName(productName) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Parse the referenceImageName from a reference_image resource. * - * @param {String} imageName - * A fully-qualified path representing a image resources. + * @param {String} referenceImageName + * A fully-qualified path representing a reference_image resources. * @returns {String} - A string representing the project. */ - matchProjectFromImageName(imageName) { - return this._pathTemplates.imagePathTemplate.match(imageName).project; + matchProjectFromReferenceImageName(referenceImageName) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; } /** - * Parse the imageName from a image resource. + * Parse the referenceImageName from a reference_image resource. * - * @param {String} imageName - * A fully-qualified path representing a image resources. + * @param {String} referenceImageName + * A fully-qualified path representing a reference_image resources. * @returns {String} - A string representing the location. */ - matchLocationFromImageName(imageName) { - return this._pathTemplates.imagePathTemplate.match(imageName).location; + matchLocationFromReferenceImageName(referenceImageName) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; } /** - * Parse the imageName from a image resource. + * Parse the referenceImageName from a reference_image resource. * - * @param {String} imageName - * A fully-qualified path representing a image resources. + * @param {String} referenceImageName + * A fully-qualified path representing a reference_image resources. * @returns {String} - A string representing the product. */ - matchProductFromImageName(imageName) { - return this._pathTemplates.imagePathTemplate.match(imageName).product; + matchProductFromReferenceImageName(referenceImageName) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; } /** - * Parse the imageName from a image resource. + * Parse the referenceImageName from a reference_image resource. * - * @param {String} imageName - * A fully-qualified path representing a image resources. - * @returns {String} - A string representing the image. + * @param {String} referenceImageName + * A fully-qualified path representing a reference_image resources. + * @returns {String} - A string representing the reference_image. */ - matchImageFromImageName(imageName) { - return this._pathTemplates.imagePathTemplate.match(imageName).image; + matchReferenceImageFromReferenceImageName(referenceImageName) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; } } diff --git a/synth.metadata b/synth.metadata new file mode 100644 index 00000000..d1d046ef --- /dev/null +++ b/synth.metadata @@ -0,0 +1,69 @@ +{ + "updateTime": "2018-12-17T12:11:28.967740Z", + "sources": [ + { + "generator": { + "name": "artman", + "version": "0.16.2", + "dockerImage": "googleapis/artman@sha256:2f6b261ee7fe1aedf238991c93a20b3820de37a343d0cacf3e3e9555c2aaf2ea" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "0f9c82d6e215430b95506fb957a9576ffda0ef3f", + "internalRef": "225558680" + } + }, + { + "template": { + "name": "node_library", + "origin": "synthtool.gcp", + "version": "2018.12.6" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "vision", + "apiVersion": "v1", + "language": "nodejs", + "generator": "gapic", + "config": "google/cloud/vision/artman_vision_v1.yaml" + } + }, + { + "client": { + "source": "googleapis", + "apiName": "vision", + "apiVersion": "v1p1beta1", + "language": "nodejs", + "generator": "gapic", + "config": "google/cloud/vision/artman_vision_v1p1beta1.yaml" + } + }, + { + "client": { + "source": "googleapis", + "apiName": "vision", + "apiVersion": "v1p2beta1", + "language": "nodejs", + "generator": "gapic", + "config": "google/cloud/vision/artman_vision_v1p2beta1.yaml" + } + }, + { + "client": { + "source": "googleapis", + "apiName": "vision", + "apiVersion": "v1p3beta1", + "language": "nodejs", + "generator": "gapic", + "config": "google/cloud/vision/artman_vision_v1p3beta1.yaml" + } + } + ] +} \ No newline at end of file diff --git a/test/gapic-v1.js b/test/gapic-v1.js index 91bf968c..ef28c5c0 100644 --- a/test/gapic-v1.js +++ b/test/gapic-v1.js @@ -442,11 +442,11 @@ describe('ProductSearchClient', () => { }); // Mock request - const formattedName = client.imagePath( + const formattedName = client.referenceImagePath( '[PROJECT]', '[LOCATION]', '[PRODUCT]', - '[IMAGE]' + '[REFERENCE_IMAGE]' ); const request = { name: formattedName, @@ -480,11 +480,11 @@ describe('ProductSearchClient', () => { }); // Mock request - const formattedName = client.imagePath( + const formattedName = client.referenceImagePath( '[PROJECT]', '[LOCATION]', '[PRODUCT]', - '[IMAGE]' + '[REFERENCE_IMAGE]' ); const request = { name: formattedName, @@ -514,11 +514,11 @@ describe('ProductSearchClient', () => { }); // Mock request - const formattedName = client.imagePath( + const formattedName = client.referenceImagePath( '[PROJECT]', '[LOCATION]', '[PRODUCT]', - '[IMAGE]' + '[REFERENCE_IMAGE]' ); const request = { name: formattedName, @@ -542,11 +542,11 @@ describe('ProductSearchClient', () => { }); // Mock request - const formattedName = client.imagePath( + const formattedName = client.referenceImagePath( '[PROJECT]', '[LOCATION]', '[PRODUCT]', - '[IMAGE]' + '[REFERENCE_IMAGE]' ); const request = { name: formattedName, From ce32146864b773aa420cfd3a96f116d8e7806ddf Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Mon, 17 Dec 2018 12:18:21 -0800 Subject: [PATCH 2/2] rename imagePath => referenceImagePath in samples --- samples/productSearch/referenceImages.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/productSearch/referenceImages.js b/samples/productSearch/referenceImages.js index 80863d20..b0abfe60 100644 --- a/samples/productSearch/referenceImages.js +++ b/samples/productSearch/referenceImages.js @@ -103,7 +103,7 @@ async function getReferenceImage( // const productId = 'Id of the product'; // const referenceImageId = 'Id of the reference image'; - const formattedName = client.imagePath( + const formattedName = client.referenceImagePath( projectId, location, productId, @@ -140,7 +140,7 @@ async function deleteReferenceImage( // const productId = 'Id of the product'; // const referenceImageId = 'Id of the reference image'; - const formattedName = client.imagePath( + const formattedName = client.referenceImagePath( projectId, location, productId,