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

Commit

Permalink
BREAKING: rename method imagePath => referenceImagePath (#296)
Browse files Browse the repository at this point in the history
* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* rename imagePath => referenceImagePath in samples
  • Loading branch information
yoshi-automation authored and jkwlui committed Dec 19, 2018
1 parent 09a0c70 commit 4dfb0a6
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 96 deletions.
1 change: 1 addition & 0 deletions protos/google/cloud/vision/v1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions protos/google/cloud/vision/v1/product_search_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
6 changes: 3 additions & 3 deletions protos/google/cloud/vision/v1/text_annotation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions samples/productSearch/referenceImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*
Expand Down Expand Up @@ -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}
*
Expand Down Expand Up @@ -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}
*
Expand Down
164 changes: 86 additions & 78 deletions src/v1/product_search_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
),
};

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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);
* });
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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,
});
}

Expand All @@ -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.
*
Expand Down Expand Up @@ -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;
}
}

Expand Down
Loading

0 comments on commit 4dfb0a6

Please sign in to comment.