diff --git a/google-api-grpc/grpc-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ProductSearchGrpc.java b/google-api-grpc/grpc-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ProductSearchGrpc.java index 8098ea084b6f..1ae87bc3751b 100644 --- a/google-api-grpc/grpc-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ProductSearchGrpc.java +++ b/google-api-grpc/grpc-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ProductSearchGrpc.java @@ -1133,8 +1133,8 @@ public void updateProductSet( * * *
-     * 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.
      * Possible errors:
      * * Returns NOT_FOUND if the ProductSet does not exist.
@@ -1620,8 +1620,8 @@ public void updateProductSet(
      *
      *
      * 
-     * 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.
      * Possible errors:
      * * Returns NOT_FOUND if the ProductSet does not exist.
@@ -2018,8 +2018,8 @@ public com.google.cloud.vision.v1.ProductSet updateProductSet(
      *
      *
      * 
-     * 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.
      * Possible errors:
      * * Returns NOT_FOUND if the ProductSet does not exist.
@@ -2372,8 +2372,8 @@ protected ProductSearchFutureStub build(
      *
      *
      * 
-     * 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.
      * Possible errors:
      * * Returns NOT_FOUND if the ProductSet does not exist.
diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Block.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Block.java
index e384a24df02a..51ca4d9e7654 100644
--- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Block.java
+++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Block.java
@@ -417,7 +417,7 @@ public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getProper
    *         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).
    * 
* * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -443,7 +443,7 @@ public boolean hasBoundingBox() { * 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). *
* * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -471,7 +471,7 @@ public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { * 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). *
* * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1242,7 +1242,7 @@ public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getProper * 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). *
* * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1268,7 +1268,7 @@ public boolean hasBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1300,7 +1300,7 @@ public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1336,7 +1336,7 @@ public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1369,7 +1369,7 @@ public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder bu * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1409,7 +1409,7 @@ public Builder mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1443,7 +1443,7 @@ public Builder clearBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1471,7 +1471,7 @@ public com.google.cloud.vision.v1.BoundingPoly.Builder getBoundingBoxBuilder() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1503,7 +1503,7 @@ public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder( * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/BlockOrBuilder.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/BlockOrBuilder.java index 7e42b728a3a2..0e1d70a38975 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/BlockOrBuilder.java +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/BlockOrBuilder.java @@ -57,7 +57,7 @@ public interface BlockOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -81,7 +81,7 @@ public interface BlockOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -105,7 +105,7 @@ public interface BlockOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorProto.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorProto.java index ad9086b809df..ae10c2828a5e 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorProto.java +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorProto.java @@ -164,193 +164,194 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "/v1/product_search.proto\032,google/cloud/v" + "ision/v1/text_annotation.proto\032*google/c" + "loud/vision/v1/web_detection.proto\032#goog" - + "le/longrunning/operations.proto\032\037google/" - + "protobuf/timestamp.proto\032\027google/rpc/sta" - + "tus.proto\032\027google/type/color.proto\032\030goog" - + "le/type/latlng.proto\"\207\003\n\007Feature\0222\n\004type" - + "\030\001 \001(\0162$.google.cloud.vision.v1.Feature." - + "Type\022\023\n\013max_results\030\002 \001(\005\022\r\n\005model\030\003 \001(\t" - + "\"\243\002\n\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\022\n\016FACE_" - + "DETECTION\020\001\022\026\n\022LANDMARK_DETECTION\020\002\022\022\n\016L" - + "OGO_DETECTION\020\003\022\023\n\017LABEL_DETECTION\020\004\022\022\n\016" - + "TEXT_DETECTION\020\005\022\033\n\027DOCUMENT_TEXT_DETECT" - + "ION\020\013\022\031\n\025SAFE_SEARCH_DETECTION\020\006\022\024\n\020IMAG" - + "E_PROPERTIES\020\007\022\016\n\nCROP_HINTS\020\t\022\021\n\rWEB_DE" - + "TECTION\020\n\022\022\n\016PRODUCT_SEARCH\020\014\022\027\n\023OBJECT_" - + "LOCALIZATION\020\023\"7\n\013ImageSource\022\025\n\rgcs_ima" - + "ge_uri\030\001 \001(\t\022\021\n\timage_uri\030\002 \001(\t\"M\n\005Image" - + "\022\017\n\007content\030\001 \001(\014\0223\n\006source\030\002 \001(\0132#.goog" - + "le.cloud.vision.v1.ImageSource\"\307\r\n\016FaceA" - + "nnotation\022;\n\rbounding_poly\030\001 \001(\0132$.googl" - + "e.cloud.vision.v1.BoundingPoly\022>\n\020fd_bou" - + "nding_poly\030\002 \001(\0132$.google.cloud.vision.v" - + "1.BoundingPoly\022B\n\tlandmarks\030\003 \003(\0132/.goog" + + "le/longrunning/operations.proto\032 google/" + + "protobuf/field_mask.proto\032\037google/protob" + + "uf/timestamp.proto\032\027google/rpc/status.pr" + + "oto\032\027google/type/color.proto\032\030google/typ" + + "e/latlng.proto\"\207\003\n\007Feature\0222\n\004type\030\001 \001(\016" + + "2$.google.cloud.vision.v1.Feature.Type\022\023" + + "\n\013max_results\030\002 \001(\005\022\r\n\005model\030\003 \001(\t\"\243\002\n\004T" + + "ype\022\024\n\020TYPE_UNSPECIFIED\020\000\022\022\n\016FACE_DETECT" + + "ION\020\001\022\026\n\022LANDMARK_DETECTION\020\002\022\022\n\016LOGO_DE" + + "TECTION\020\003\022\023\n\017LABEL_DETECTION\020\004\022\022\n\016TEXT_D" + + "ETECTION\020\005\022\033\n\027DOCUMENT_TEXT_DETECTION\020\013\022" + + "\031\n\025SAFE_SEARCH_DETECTION\020\006\022\024\n\020IMAGE_PROP" + + "ERTIES\020\007\022\016\n\nCROP_HINTS\020\t\022\021\n\rWEB_DETECTIO" + + "N\020\n\022\022\n\016PRODUCT_SEARCH\020\014\022\027\n\023OBJECT_LOCALI" + + "ZATION\020\023\"7\n\013ImageSource\022\025\n\rgcs_image_uri" + + "\030\001 \001(\t\022\021\n\timage_uri\030\002 \001(\t\"M\n\005Image\022\017\n\007co" + + "ntent\030\001 \001(\014\0223\n\006source\030\002 \001(\0132#.google.clo" + + "ud.vision.v1.ImageSource\"\307\r\n\016FaceAnnotat" + + "ion\022;\n\rbounding_poly\030\001 \001(\0132$.google.clou" + + "d.vision.v1.BoundingPoly\022>\n\020fd_bounding_" + + "poly\030\002 \001(\0132$.google.cloud.vision.v1.Boun" + + "dingPoly\022B\n\tlandmarks\030\003 \003(\0132/.google.clo" + + "ud.vision.v1.FaceAnnotation.Landmark\022\022\n\n" + + "roll_angle\030\004 \001(\002\022\021\n\tpan_angle\030\005 \001(\002\022\022\n\nt" + + "ilt_angle\030\006 \001(\002\022\034\n\024detection_confidence\030" + + "\007 \001(\002\022\036\n\026landmarking_confidence\030\010 \001(\002\022:\n" + + "\016joy_likelihood\030\t \001(\0162\".google.cloud.vis" + + "ion.v1.Likelihood\022=\n\021sorrow_likelihood\030\n" + + " \001(\0162\".google.cloud.vision.v1.Likelihood" + + "\022<\n\020anger_likelihood\030\013 \001(\0162\".google.clou" + + "d.vision.v1.Likelihood\022?\n\023surprise_likel" + + "ihood\030\014 \001(\0162\".google.cloud.vision.v1.Lik" + + "elihood\022D\n\030under_exposed_likelihood\030\r \001(" + + "\0162\".google.cloud.vision.v1.Likelihood\022>\n" + + "\022blurred_likelihood\030\016 \001(\0162\".google.cloud" + + ".vision.v1.Likelihood\022?\n\023headwear_likeli" + + "hood\030\017 \001(\0162\".google.cloud.vision.v1.Like" + + "lihood\032\271\007\n\010Landmark\022B\n\004type\030\003 \001(\01624.goog" + "le.cloud.vision.v1.FaceAnnotation.Landma" - + "rk\022\022\n\nroll_angle\030\004 \001(\002\022\021\n\tpan_angle\030\005 \001(" - + "\002\022\022\n\ntilt_angle\030\006 \001(\002\022\034\n\024detection_confi" - + "dence\030\007 \001(\002\022\036\n\026landmarking_confidence\030\010 " - + "\001(\002\022:\n\016joy_likelihood\030\t \001(\0162\".google.clo" - + "ud.vision.v1.Likelihood\022=\n\021sorrow_likeli" - + "hood\030\n \001(\0162\".google.cloud.vision.v1.Like" - + "lihood\022<\n\020anger_likelihood\030\013 \001(\0162\".googl" - + "e.cloud.vision.v1.Likelihood\022?\n\023surprise" - + "_likelihood\030\014 \001(\0162\".google.cloud.vision." - + "v1.Likelihood\022D\n\030under_exposed_likelihoo" - + "d\030\r \001(\0162\".google.cloud.vision.v1.Likelih" - + "ood\022>\n\022blurred_likelihood\030\016 \001(\0162\".google" - + ".cloud.vision.v1.Likelihood\022?\n\023headwear_" - + "likelihood\030\017 \001(\0162\".google.cloud.vision.v" - + "1.Likelihood\032\271\007\n\010Landmark\022B\n\004type\030\003 \001(\0162" - + "4.google.cloud.vision.v1.FaceAnnotation." - + "Landmark.Type\0222\n\010position\030\004 \001(\0132 .google" - + ".cloud.vision.v1.Position\"\264\006\n\004Type\022\024\n\020UN" - + "KNOWN_LANDMARK\020\000\022\014\n\010LEFT_EYE\020\001\022\r\n\tRIGHT_" - + "EYE\020\002\022\030\n\024LEFT_OF_LEFT_EYEBROW\020\003\022\031\n\025RIGHT" - + "_OF_LEFT_EYEBROW\020\004\022\031\n\025LEFT_OF_RIGHT_EYEB" - + "ROW\020\005\022\032\n\026RIGHT_OF_RIGHT_EYEBROW\020\006\022\031\n\025MID" - + "POINT_BETWEEN_EYES\020\007\022\014\n\010NOSE_TIP\020\010\022\r\n\tUP" - + "PER_LIP\020\t\022\r\n\tLOWER_LIP\020\n\022\016\n\nMOUTH_LEFT\020\013" - + "\022\017\n\013MOUTH_RIGHT\020\014\022\020\n\014MOUTH_CENTER\020\r\022\025\n\021N" - + "OSE_BOTTOM_RIGHT\020\016\022\024\n\020NOSE_BOTTOM_LEFT\020\017" - + "\022\026\n\022NOSE_BOTTOM_CENTER\020\020\022\031\n\025LEFT_EYE_TOP" - + "_BOUNDARY\020\021\022\031\n\025LEFT_EYE_RIGHT_CORNER\020\022\022\034" - + "\n\030LEFT_EYE_BOTTOM_BOUNDARY\020\023\022\030\n\024LEFT_EYE" - + "_LEFT_CORNER\020\024\022\032\n\026RIGHT_EYE_TOP_BOUNDARY" - + "\020\025\022\032\n\026RIGHT_EYE_RIGHT_CORNER\020\026\022\035\n\031RIGHT_" - + "EYE_BOTTOM_BOUNDARY\020\027\022\031\n\025RIGHT_EYE_LEFT_" - + "CORNER\020\030\022\037\n\033LEFT_EYEBROW_UPPER_MIDPOINT\020" - + "\031\022 \n\034RIGHT_EYEBROW_UPPER_MIDPOINT\020\032\022\024\n\020L" - + "EFT_EAR_TRAGION\020\033\022\025\n\021RIGHT_EAR_TRAGION\020\034" - + "\022\022\n\016LEFT_EYE_PUPIL\020\035\022\023\n\017RIGHT_EYE_PUPIL\020" - + "\036\022\025\n\021FOREHEAD_GLABELLA\020\037\022\021\n\rCHIN_GNATHIO" - + "N\020 \022\024\n\020CHIN_LEFT_GONION\020!\022\025\n\021CHIN_RIGHT_" - + "GONION\020\"\"4\n\014LocationInfo\022$\n\007lat_lng\030\001 \001(" - + "\0132\023.google.type.LatLng\"=\n\010Property\022\014\n\004na" - + "me\030\001 \001(\t\022\r\n\005value\030\002 \001(\t\022\024\n\014uint64_value\030" - + "\003 \001(\004\"\253\002\n\020EntityAnnotation\022\013\n\003mid\030\001 \001(\t\022" - + "\016\n\006locale\030\002 \001(\t\022\023\n\013description\030\003 \001(\t\022\r\n\005" - + "score\030\004 \001(\002\022\026\n\nconfidence\030\005 \001(\002B\002\030\001\022\022\n\nt" - + "opicality\030\006 \001(\002\022;\n\rbounding_poly\030\007 \001(\0132$" - + ".google.cloud.vision.v1.BoundingPoly\0227\n\t" - + "locations\030\010 \003(\0132$.google.cloud.vision.v1" - + ".LocationInfo\0224\n\nproperties\030\t \003(\0132 .goog" - + "le.cloud.vision.v1.Property\"\231\001\n\031Localize" - + "dObjectAnnotation\022\013\n\003mid\030\001 \001(\t\022\025\n\rlangua" - + "ge_code\030\002 \001(\t\022\014\n\004name\030\003 \001(\t\022\r\n\005score\030\004 \001" - + "(\002\022;\n\rbounding_poly\030\005 \001(\0132$.google.cloud" - + ".vision.v1.BoundingPoly\"\231\002\n\024SafeSearchAn" - + "notation\0221\n\005adult\030\001 \001(\0162\".google.cloud.v" - + "ision.v1.Likelihood\0221\n\005spoof\030\002 \001(\0162\".goo" - + "gle.cloud.vision.v1.Likelihood\0223\n\007medica" - + "l\030\003 \001(\0162\".google.cloud.vision.v1.Likelih" - + "ood\0224\n\010violence\030\004 \001(\0162\".google.cloud.vis" - + "ion.v1.Likelihood\0220\n\004racy\030\t \001(\0162\".google" - + ".cloud.vision.v1.Likelihood\"a\n\013LatLongRe" - + "ct\022(\n\013min_lat_lng\030\001 \001(\0132\023.google.type.La" - + "tLng\022(\n\013max_lat_lng\030\002 \001(\0132\023.google.type." - + "LatLng\"U\n\tColorInfo\022!\n\005color\030\001 \001(\0132\022.goo" - + "gle.type.Color\022\r\n\005score\030\002 \001(\002\022\026\n\016pixel_f" - + "raction\030\003 \001(\002\"M\n\030DominantColorsAnnotatio" - + "n\0221\n\006colors\030\001 \003(\0132!.google.cloud.vision." - + "v1.ColorInfo\"\\\n\017ImageProperties\022I\n\017domin" - + "ant_colors\030\001 \001(\01320.google.cloud.vision.v" - + "1.DominantColorsAnnotation\"x\n\010CropHint\022;" - + "\n\rbounding_poly\030\001 \001(\0132$.google.cloud.vis" - + "ion.v1.BoundingPoly\022\022\n\nconfidence\030\002 \001(\002\022" - + "\033\n\023importance_fraction\030\003 \001(\002\"K\n\023CropHint" - + "sAnnotation\0224\n\ncrop_hints\030\001 \003(\0132 .google" - + ".cloud.vision.v1.CropHint\"(\n\017CropHintsPa" - + "rams\022\025\n\raspect_ratios\030\001 \003(\002\"1\n\022WebDetect" - + "ionParams\022\033\n\023include_geo_results\030\002 \001(\010\"\274" - + "\002\n\014ImageContext\022:\n\rlat_long_rect\030\001 \001(\0132#" - + ".google.cloud.vision.v1.LatLongRect\022\026\n\016l" - + "anguage_hints\030\002 \003(\t\022B\n\021crop_hints_params" - + "\030\004 \001(\0132\'.google.cloud.vision.v1.CropHint" - + "sParams\022J\n\025product_search_params\030\005 \001(\0132+" - + ".google.cloud.vision.v1.ProductSearchPar" - + "ams\022H\n\024web_detection_params\030\006 \001(\0132*.goog" - + "le.cloud.vision.v1.WebDetectionParams\"\264\001" - + "\n\024AnnotateImageRequest\022,\n\005image\030\001 \001(\0132\035." - + "google.cloud.vision.v1.Image\0221\n\010features" - + "\030\002 \003(\0132\037.google.cloud.vision.v1.Feature\022" - + ";\n\rimage_context\030\003 \001(\0132$.google.cloud.vi" - + "sion.v1.ImageContext\":\n\026ImageAnnotationC" - + "ontext\022\013\n\003uri\030\001 \001(\t\022\023\n\013page_number\030\002 \001(\005" - + "\"\344\007\n\025AnnotateImageResponse\022@\n\020face_annot" - + "ations\030\001 \003(\0132&.google.cloud.vision.v1.Fa" - + "ceAnnotation\022F\n\024landmark_annotations\030\002 \003" - + "(\0132(.google.cloud.vision.v1.EntityAnnota" - + "tion\022B\n\020logo_annotations\030\003 \003(\0132(.google." - + "cloud.vision.v1.EntityAnnotation\022C\n\021labe" - + "l_annotations\030\004 \003(\0132(.google.cloud.visio" - + "n.v1.EntityAnnotation\022W\n\034localized_objec" - + "t_annotations\030\026 \003(\01321.google.cloud.visio" - + "n.v1.LocalizedObjectAnnotation\022B\n\020text_a" - + "nnotations\030\005 \003(\0132(.google.cloud.vision.v" - + "1.EntityAnnotation\022D\n\024full_text_annotati" - + "on\030\014 \001(\0132&.google.cloud.vision.v1.TextAn" - + "notation\022L\n\026safe_search_annotation\030\006 \001(\013" - + "2,.google.cloud.vision.v1.SafeSearchAnno" - + "tation\022L\n\033image_properties_annotation\030\010 " - + "\001(\0132\'.google.cloud.vision.v1.ImageProper" - + "ties\022J\n\025crop_hints_annotation\030\013 \001(\0132+.go" - + "ogle.cloud.vision.v1.CropHintsAnnotation" - + "\022;\n\rweb_detection\030\r \001(\0132$.google.cloud.v" - + "ision.v1.WebDetection\022L\n\026product_search_" - + "results\030\016 \001(\0132,.google.cloud.vision.v1.P" - + "roductSearchResults\022!\n\005error\030\t \001(\0132\022.goo" - + "gle.rpc.Status\022?\n\007context\030\025 \001(\0132..google" - + ".cloud.vision.v1.ImageAnnotationContext\"" - + "\223\001\n\024AnnotateFileResponse\0229\n\014input_config" - + "\030\001 \001(\0132#.google.cloud.vision.v1.InputCon" - + "fig\022@\n\tresponses\030\002 \003(\0132-.google.cloud.vi" - + "sion.v1.AnnotateImageResponse\"\\\n\032BatchAn" - + "notateImagesRequest\022>\n\010requests\030\001 \003(\0132,." - + "google.cloud.vision.v1.AnnotateImageRequ" - + "est\"_\n\033BatchAnnotateImagesResponse\022@\n\tre" - + "sponses\030\001 \003(\0132-.google.cloud.vision.v1.A" - + "nnotateImageResponse\"\202\002\n\030AsyncAnnotateFi" - + "leRequest\0229\n\014input_config\030\001 \001(\0132#.google" - + ".cloud.vision.v1.InputConfig\0221\n\010features" - + "\030\002 \003(\0132\037.google.cloud.vision.v1.Feature\022" - + ";\n\rimage_context\030\003 \001(\0132$.google.cloud.vi" - + "sion.v1.ImageContext\022;\n\routput_config\030\004 " - + "\001(\0132$.google.cloud.vision.v1.OutputConfi" - + "g\"X\n\031AsyncAnnotateFileResponse\022;\n\routput" - + "_config\030\001 \001(\0132$.google.cloud.vision.v1.O" - + "utputConfig\"d\n\036AsyncBatchAnnotateFilesRe" - + "quest\022B\n\010requests\030\001 \003(\01320.google.cloud.v" - + "ision.v1.AsyncAnnotateFileRequest\"g\n\037Asy" - + "ncBatchAnnotateFilesResponse\022D\n\tresponse" - + "s\030\001 \003(\01321.google.cloud.vision.v1.AsyncAn" - + "notateFileResponse\"W\n\013InputConfig\0225\n\ngcs" - + "_source\030\001 \001(\0132!.google.cloud.vision.v1.G" - + "csSource\022\021\n\tmime_type\030\002 \001(\t\"c\n\014OutputCon" - + "fig\022?\n\017gcs_destination\030\001 \001(\0132&.google.cl" - + "oud.vision.v1.GcsDestination\022\022\n\nbatch_si" - + "ze\030\002 \001(\005\"\030\n\tGcsSource\022\013\n\003uri\030\001 \001(\t\"\035\n\016Gc" - + "sDestination\022\013\n\003uri\030\001 \001(\t\"\210\002\n\021OperationM" - + "etadata\022>\n\005state\030\001 \001(\0162/.google.cloud.vi" - + "sion.v1.OperationMetadata.State\022/\n\013creat" - + "e_time\030\005 \001(\0132\032.google.protobuf.Timestamp" - + "\022/\n\013update_time\030\006 \001(\0132\032.google.protobuf." - + "Timestamp\"Q\n\005State\022\025\n\021STATE_UNSPECIFIED\020" - + "\000\022\013\n\007CREATED\020\001\022\013\n\007RUNNING\020\002\022\010\n\004DONE\020\003\022\r\n" - + "\tCANCELLED\020\004*e\n\nLikelihood\022\013\n\007UNKNOWN\020\000\022" - + "\021\n\rVERY_UNLIKELY\020\001\022\014\n\010UNLIKELY\020\002\022\014\n\010POSS" - + "IBLE\020\003\022\n\n\006LIKELY\020\004\022\017\n\013VERY_LIKELY\020\0052\315\002\n\016" - + "ImageAnnotator\022\236\001\n\023BatchAnnotateImages\0222" - + ".google.cloud.vision.v1.BatchAnnotateIma" - + "gesRequest\0323.google.cloud.vision.v1.Batc" - + "hAnnotateImagesResponse\"\036\202\323\344\223\002\030\"\023/v1/ima" - + "ges:annotate:\001*\022\231\001\n\027AsyncBatchAnnotateFi" - + "les\0226.google.cloud.vision.v1.AsyncBatchA" - + "nnotateFilesRequest\032\035.google.longrunning" - + ".Operation\"\'\202\323\344\223\002!\"\034/v1/files:asyncBatch" - + "Annotate:\001*B{\n\032com.google.cloud.vision.v" - + "1B\023ImageAnnotatorProtoP\001Z\n\010requests\030\001 \003(\0132,.google" + + ".cloud.vision.v1.AnnotateImageRequest\"_\n" + + "\033BatchAnnotateImagesResponse\022@\n\tresponse" + + "s\030\001 \003(\0132-.google.cloud.vision.v1.Annotat" + + "eImageResponse\"\202\002\n\030AsyncAnnotateFileRequ" + + "est\0229\n\014input_config\030\001 \001(\0132#.google.cloud" + + ".vision.v1.InputConfig\0221\n\010features\030\002 \003(\013" + + "2\037.google.cloud.vision.v1.Feature\022;\n\rima" + + "ge_context\030\003 \001(\0132$.google.cloud.vision.v" + + "1.ImageContext\022;\n\routput_config\030\004 \001(\0132$." + + "google.cloud.vision.v1.OutputConfig\"X\n\031A" + + "syncAnnotateFileResponse\022;\n\routput_confi" + + "g\030\001 \001(\0132$.google.cloud.vision.v1.OutputC" + + "onfig\"d\n\036AsyncBatchAnnotateFilesRequest\022" + + "B\n\010requests\030\001 \003(\01320.google.cloud.vision." + + "v1.AsyncAnnotateFileRequest\"g\n\037AsyncBatc" + + "hAnnotateFilesResponse\022D\n\tresponses\030\001 \003(" + + "\01321.google.cloud.vision.v1.AsyncAnnotate" + + "FileResponse\"W\n\013InputConfig\0225\n\ngcs_sourc" + + "e\030\001 \001(\0132!.google.cloud.vision.v1.GcsSour" + + "ce\022\021\n\tmime_type\030\002 \001(\t\"c\n\014OutputConfig\022?\n" + + "\017gcs_destination\030\001 \001(\0132&.google.cloud.vi" + + "sion.v1.GcsDestination\022\022\n\nbatch_size\030\002 \001" + + "(\005\"\030\n\tGcsSource\022\013\n\003uri\030\001 \001(\t\"\035\n\016GcsDesti" + + "nation\022\013\n\003uri\030\001 \001(\t\"\210\002\n\021OperationMetadat" + + "a\022>\n\005state\030\001 \001(\0162/.google.cloud.vision.v" + + "1.OperationMetadata.State\022/\n\013create_time" + + "\030\005 \001(\0132\032.google.protobuf.Timestamp\022/\n\013up" + + "date_time\030\006 \001(\0132\032.google.protobuf.Timest" + + "amp\"Q\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\013\n\007C" + + "REATED\020\001\022\013\n\007RUNNING\020\002\022\010\n\004DONE\020\003\022\r\n\tCANCE" + + "LLED\020\004*e\n\nLikelihood\022\013\n\007UNKNOWN\020\000\022\021\n\rVER" + + "Y_UNLIKELY\020\001\022\014\n\010UNLIKELY\020\002\022\014\n\010POSSIBLE\020\003" + + "\022\n\n\006LIKELY\020\004\022\017\n\013VERY_LIKELY\020\0052\315\002\n\016ImageA" + + "nnotator\022\236\001\n\023BatchAnnotateImages\0222.googl" + + "e.cloud.vision.v1.BatchAnnotateImagesReq" + + "uest\0323.google.cloud.vision.v1.BatchAnnot" + + "ateImagesResponse\"\036\202\323\344\223\002\030\"\023/v1/images:an" + + "notate:\001*\022\231\001\n\027AsyncBatchAnnotateFiles\0226." + + "google.cloud.vision.v1.AsyncBatchAnnotat" + + "eFilesRequest\032\035.google.longrunning.Opera" + + "tion\"\'\202\323\344\223\002!\"\034/v1/files:asyncBatchAnnota" + + "te:\001*B{\n\032com.google.cloud.vision.v1B\023Ima" + + "geAnnotatorProtoP\001Z * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -224,7 +224,7 @@ public boolean hasBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -252,7 +252,7 @@ public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -978,7 +978,7 @@ public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getProper * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1004,7 +1004,7 @@ public boolean hasBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1036,7 +1036,7 @@ public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1072,7 +1072,7 @@ public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1105,7 +1105,7 @@ public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder bu * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1145,7 +1145,7 @@ public Builder mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1179,7 +1179,7 @@ public Builder clearBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1207,7 +1207,7 @@ public com.google.cloud.vision.v1.BoundingPoly.Builder getBoundingBoxBuilder() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1239,7 +1239,7 @@ public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder( * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ParagraphOrBuilder.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ParagraphOrBuilder.java index 35d79db2020a..74054108daed 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ParagraphOrBuilder.java +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ParagraphOrBuilder.java @@ -57,7 +57,7 @@ public interface ParagraphOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -81,7 +81,7 @@ public interface ParagraphOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -105,7 +105,7 @@ public interface ParagraphOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ReferenceImageName.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ReferenceImageName.java new file mode 100644 index 000000000000..c25b93f10200 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/ReferenceImageName.java @@ -0,0 +1,249 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.cloud.vision.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class ReferenceImageName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + private final String product; + private final String referenceImage; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getProduct() { + return product; + } + + public String getReferenceImage() { + return referenceImage; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ReferenceImageName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + product = Preconditions.checkNotNull(builder.getProduct()); + referenceImage = Preconditions.checkNotNull(builder.getReferenceImage()); + } + + public static ReferenceImageName of( + String project, String location, String product, String referenceImage) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setProduct(product) + .setReferenceImage(referenceImage) + .build(); + } + + public static String format( + String project, String location, String product, String referenceImage) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setProduct(product) + .setReferenceImage(referenceImage) + .build() + .toString(); + } + + public static ReferenceImageName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ReferenceImageName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("product"), + matchMap.get("reference_image")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (ReferenceImageName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldMapBuilder.put("product", product); + fieldMapBuilder.put("referenceImage", referenceImage); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", + project, + "location", + location, + "product", + product, + "reference_image", + referenceImage); + } + + /** Builder for ReferenceImageName. */ + public static class Builder { + + private String project; + private String location; + private String product; + private String referenceImage; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getProduct() { + return product; + } + + public String getReferenceImage() { + return referenceImage; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setProduct(String product) { + this.product = product; + return this; + } + + public Builder setReferenceImage(String referenceImage) { + this.referenceImage = referenceImage; + return this; + } + + private Builder() {} + + private Builder(ReferenceImageName referenceImageName) { + project = referenceImageName.project; + location = referenceImageName.location; + product = referenceImageName.product; + referenceImage = referenceImageName.referenceImage; + } + + public ReferenceImageName build() { + return new ReferenceImageName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ReferenceImageName) { + ReferenceImageName that = (ReferenceImageName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)) + && (this.product.equals(that.product)) + && (this.referenceImage.equals(that.referenceImage)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + h *= 1000003; + h ^= product.hashCode(); + h *= 1000003; + h ^= referenceImage.hashCode(); + return h; + } +} diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Word.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Word.java index 9a5090d505d3..a469b1b8adc1 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Word.java +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/Word.java @@ -197,7 +197,7 @@ public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getProper * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -223,7 +223,7 @@ public boolean hasBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -251,7 +251,7 @@ public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -981,7 +981,7 @@ public com.google.cloud.vision.v1.TextAnnotation.TextPropertyOrBuilder getProper * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1007,7 +1007,7 @@ public boolean hasBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1039,7 +1039,7 @@ public com.google.cloud.vision.v1.BoundingPoly getBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1075,7 +1075,7 @@ public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1108,7 +1108,7 @@ public Builder setBoundingBox(com.google.cloud.vision.v1.BoundingPoly.Builder bu * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1148,7 +1148,7 @@ public Builder mergeBoundingBox(com.google.cloud.vision.v1.BoundingPoly value) { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1182,7 +1182,7 @@ public Builder clearBoundingBox() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1210,7 +1210,7 @@ public com.google.cloud.vision.v1.BoundingPoly.Builder getBoundingBoxBuilder() { * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -1242,7 +1242,7 @@ public com.google.cloud.vision.v1.BoundingPolyOrBuilder getBoundingBoxOrBuilder( * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/WordOrBuilder.java b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/WordOrBuilder.java index d9db82b89bb4..94401d7048d1 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/WordOrBuilder.java +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/java/com/google/cloud/vision/v1/WordOrBuilder.java @@ -57,7 +57,7 @@ public interface WordOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -81,7 +81,7 @@ public interface WordOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; @@ -105,7 +105,7 @@ public interface WordOrBuilder * 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). * * * .google.cloud.vision.v1.BoundingPoly bounding_box = 2; diff --git a/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/image_annotator.proto b/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/image_annotator.proto index a7235f7a1adb..1f768c208d7b 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/image_annotator.proto +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/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/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/product_search_service.proto b/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/product_search_service.proto index f8ae08e33c84..d017d27ff377 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/product_search_service.proto +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/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/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/text_annotation.proto b/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/text_annotation.proto index c66c9114f1f7..44ebcdaeea50 100644 --- a/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/google/cloud/vision/v1/text_annotation.proto +++ b/google-api-grpc/proto-google-cloud-vision-v1/src/main/proto/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/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java index cbbfa2cd1cb5..8f3b95de6cf6 100644 --- a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java +++ b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java @@ -27,7 +27,6 @@ import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; -import com.google.api.pathtemplate.PathTemplate; import com.google.cloud.vision.v1.stub.ProductSearchStub; import com.google.cloud.vision.v1.stub.ProductSearchStubSettings; import com.google.longrunning.Operation; @@ -63,10 +62,10 @@ *
  * 
  * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
- *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
  *   Product product = Product.newBuilder().build();
  *   String productId = "";
- *   Product response = productSearchClient.createProduct(formattedParent, product, productId);
+ *   Product response = productSearchClient.createProduct(parent, product, productId);
  * }
  * 
  * 
@@ -127,129 +126,6 @@ public class ProductSearchClient implements BackgroundResource { private final ProductSearchStub stub; private final OperationsClient operationsClient; - private static final PathTemplate LOCATION_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - - private static final PathTemplate PRODUCT_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/products/{product}"); - - private static final PathTemplate PRODUCT_SET_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/productSets/{product_set}"); - - private static final PathTemplate IMAGE_PATH_TEMPLATE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/products/{product}/referenceImages/{image}"); - - /** Formats a string containing the fully-qualified path to represent a location resource. */ - public static final String formatLocationName(String project, String location) { - return LOCATION_PATH_TEMPLATE.instantiate( - "project", project, - "location", location); - } - - /** Formats a string containing the fully-qualified path to represent a product resource. */ - public static final String formatProductName(String project, String location, String product) { - return PRODUCT_PATH_TEMPLATE.instantiate( - "project", project, - "location", location, - "product", product); - } - - /** Formats a string containing the fully-qualified path to represent a product_set resource. */ - public static final String formatProductSetName( - String project, String location, String productSet) { - return PRODUCT_SET_PATH_TEMPLATE.instantiate( - "project", project, - "location", location, - "product_set", productSet); - } - - /** Formats a string containing the fully-qualified path to represent a image resource. */ - public static final String formatImageName( - String project, String location, String product, String image) { - return IMAGE_PATH_TEMPLATE.instantiate( - "project", project, - "location", location, - "product", product, - "image", image); - } - - /** - * Parses the project from the given fully-qualified path which represents a location resource. - */ - public static final String parseProjectFromLocationName(String locationName) { - return LOCATION_PATH_TEMPLATE.parse(locationName).get("project"); - } - - /** - * Parses the location from the given fully-qualified path which represents a location resource. - */ - public static final String parseLocationFromLocationName(String locationName) { - return LOCATION_PATH_TEMPLATE.parse(locationName).get("location"); - } - - /** Parses the project from the given fully-qualified path which represents a product resource. */ - public static final String parseProjectFromProductName(String productName) { - return PRODUCT_PATH_TEMPLATE.parse(productName).get("project"); - } - - /** - * Parses the location from the given fully-qualified path which represents a product resource. - */ - public static final String parseLocationFromProductName(String productName) { - return PRODUCT_PATH_TEMPLATE.parse(productName).get("location"); - } - - /** Parses the product from the given fully-qualified path which represents a product resource. */ - public static final String parseProductFromProductName(String productName) { - return PRODUCT_PATH_TEMPLATE.parse(productName).get("product"); - } - - /** - * Parses the project from the given fully-qualified path which represents a product_set resource. - */ - public static final String parseProjectFromProductSetName(String productSetName) { - return PRODUCT_SET_PATH_TEMPLATE.parse(productSetName).get("project"); - } - - /** - * Parses the location from the given fully-qualified path which represents a product_set - * resource. - */ - public static final String parseLocationFromProductSetName(String productSetName) { - return PRODUCT_SET_PATH_TEMPLATE.parse(productSetName).get("location"); - } - - /** - * Parses the product_set from the given fully-qualified path which represents a product_set - * resource. - */ - public static final String parseProductSetFromProductSetName(String productSetName) { - return PRODUCT_SET_PATH_TEMPLATE.parse(productSetName).get("product_set"); - } - - /** Parses the project from the given fully-qualified path which represents a image resource. */ - public static final String parseProjectFromImageName(String imageName) { - return IMAGE_PATH_TEMPLATE.parse(imageName).get("project"); - } - - /** Parses the location from the given fully-qualified path which represents a image resource. */ - public static final String parseLocationFromImageName(String imageName) { - return IMAGE_PATH_TEMPLATE.parse(imageName).get("location"); - } - - /** Parses the product from the given fully-qualified path which represents a image resource. */ - public static final String parseProductFromImageName(String imageName) { - return IMAGE_PATH_TEMPLATE.parse(imageName).get("product"); - } - - /** Parses the image from the given fully-qualified path which represents a image resource. */ - public static final String parseImageFromImageName(String imageName) { - return IMAGE_PATH_TEMPLATE.parse(imageName).get("image"); - } - /** Constructs an instance of ProductSearchClient with default settings. */ public static final ProductSearchClient create() throws IOException { return create(ProductSearchSettings.newBuilder().build()); @@ -324,10 +200,51 @@ public final OperationsClient getOperationsClient() { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   Product product = Product.newBuilder().build();
    *   String productId = "";
-   *   Product response = productSearchClient.createProduct(formattedParent, product, productId);
+   *   Product response = productSearchClient.createProduct(parent, product, productId);
+   * }
+   * 
+ * + * @param parent The project in which the Product should be created. + *

Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param product The product to create. + * @param productId 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 + * `/`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product createProduct(LocationName parent, Product product, String productId) { + + CreateProductRequest request = + CreateProductRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setProduct(product) + .setProductId(productId) + .build(); + return createProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Product product = Product.newBuilder().build();
+   *   String productId = "";
+   *   Product response = productSearchClient.createProduct(parent.toString(), product, productId);
    * }
    * 
* @@ -341,7 +258,7 @@ public final OperationsClient getOperationsClient() { * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Product createProduct(String parent, Product product, String productId) { - LOCATION_PATH_TEMPLATE.validate(parent, "createProduct"); + CreateProductRequest request = CreateProductRequest.newBuilder() .setParent(parent) @@ -365,10 +282,10 @@ public final Product createProduct(String parent, Product product, String produc * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   Product product = Product.newBuilder().build();
    *   CreateProductRequest request = CreateProductRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setProduct(product)
    *     .build();
    *   Product response = productSearchClient.createProduct(request);
@@ -396,10 +313,10 @@ public final Product createProduct(CreateProductRequest request) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   Product product = Product.newBuilder().build();
    *   CreateProductRequest request = CreateProductRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setProduct(product)
    *     .build();
    *   ApiFuture<Product> future = productSearchClient.createProductCallable().futureCall(request);
@@ -424,8 +341,39 @@ public final UnaryCallable createProductCallable(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
-   *   for (Product element : productSearchClient.listProducts(formattedParent).iterateAll()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Product element : productSearchClient.listProducts(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent The project OR ProductSet from which Products should be listed. + *

Format: `projects/PROJECT_ID/locations/LOC_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListProductsPagedResponse listProducts(LocationName parent) { + ListProductsRequest request = + ListProductsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listProducts(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists products in an unspecified order. + * + *

Possible errors: + * + *

* Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Product element : productSearchClient.listProducts(parent.toString()).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -436,7 +384,6 @@ public final UnaryCallable createProductCallable(
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListProductsPagedResponse listProducts(String parent) {
-    LOCATION_PATH_TEMPLATE.validate(parent, "listProducts");
     ListProductsRequest request = ListProductsRequest.newBuilder().setParent(parent).build();
     return listProducts(request);
   }
@@ -453,9 +400,9 @@ public final ListProductsPagedResponse listProducts(String parent) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ListProductsRequest request = ListProductsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (Product element : productSearchClient.listProducts(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -482,9 +429,9 @@ public final ListProductsPagedResponse listProducts(ListProductsRequest request)
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ListProductsRequest request = ListProductsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListProductsPagedResponse> future = productSearchClient.listProductsPagedCallable().futureCall(request);
    *   // Do something
@@ -511,9 +458,9 @@ public final ListProductsPagedResponse listProducts(ListProductsRequest request)
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ListProductsRequest request = ListProductsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListProductsResponse response = productSearchClient.listProductsCallable().call(request);
@@ -546,8 +493,36 @@ public final UnaryCallable listProduc
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
-   *   Product response = productSearchClient.getProduct(formattedName);
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   Product response = productSearchClient.getProduct(name);
+   * }
+   * 
+ * + * @param name Resource name of the Product to get. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Product getProduct(ProductName name) { + + GetProductRequest request = + GetProductRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information associated with a Product. + * + *

Possible errors: + * + *

* Returns NOT_FOUND if the Product does not exist. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   Product response = productSearchClient.getProduct(name.toString());
    * }
    * 
* @@ -556,7 +531,7 @@ public final UnaryCallable listProduc * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Product getProduct(String name) { - PRODUCT_PATH_TEMPLATE.validate(name, "getProduct"); + GetProductRequest request = GetProductRequest.newBuilder().setName(name).build(); return getProduct(request); } @@ -573,9 +548,9 @@ public final Product getProduct(String name) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   GetProductRequest request = GetProductRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   Product response = productSearchClient.getProduct(request);
    * }
@@ -600,9 +575,9 @@ public final Product getProduct(GetProductRequest request) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   GetProductRequest request = GetProductRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Product> future = productSearchClient.getProductCallable().futureCall(request);
    *   // Do something
@@ -739,8 +714,40 @@ public final UnaryCallable updateProductCallable(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
-   *   productSearchClient.deleteProduct(formattedName);
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   productSearchClient.deleteProduct(name);
+   * }
+   * 
+ * + * @param name Resource name of product to delete. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteProduct(ProductName name) { + + DeleteProductRequest request = + DeleteProductRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteProduct(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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. + * + *

Possible errors: + * + *

* Returns NOT_FOUND if the product does not exist. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   productSearchClient.deleteProduct(name.toString());
    * }
    * 
* @@ -749,7 +756,7 @@ public final UnaryCallable updateProductCallable( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteProduct(String name) { - PRODUCT_PATH_TEMPLATE.validate(name, "deleteProduct"); + DeleteProductRequest request = DeleteProductRequest.newBuilder().setName(name).build(); deleteProduct(request); } @@ -770,9 +777,9 @@ public final void deleteProduct(String name) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   DeleteProductRequest request = DeleteProductRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   productSearchClient.deleteProduct(request);
    * }
@@ -801,9 +808,9 @@ public final void deleteProduct(DeleteProductRequest request) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   DeleteProductRequest request = DeleteProductRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = productSearchClient.deleteProductCallable().futureCall(request);
    *   // Do something
@@ -828,8 +835,40 @@ public final UnaryCallable deleteProductCallable()
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
-   *   for (ReferenceImage element : productSearchClient.listReferenceImages(formattedParent).iterateAll()) {
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   for (ReferenceImage element : productSearchClient.listReferenceImages(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Resource name of the product containing the reference images. + *

Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReferenceImagesPagedResponse listReferenceImages(ProductName parent) { + ListReferenceImagesRequest request = + ListReferenceImagesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listReferenceImages(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists reference images. + * + *

Possible errors: + * + *

* Returns NOT_FOUND if the parent product does not exist. * Returns INVALID_ARGUMENT + * if the page_size is greater than 100, or less than 1. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   for (ReferenceImage element : productSearchClient.listReferenceImages(parent.toString()).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -840,7 +879,6 @@ public final UnaryCallable deleteProductCallable()
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListReferenceImagesPagedResponse listReferenceImages(String parent) {
-    PRODUCT_PATH_TEMPLATE.validate(parent, "listReferenceImages");
     ListReferenceImagesRequest request =
         ListReferenceImagesRequest.newBuilder().setParent(parent).build();
     return listReferenceImages(request);
@@ -859,9 +897,9 @@ public final ListReferenceImagesPagedResponse listReferenceImages(String parent)
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   ListReferenceImagesRequest request = ListReferenceImagesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (ReferenceImage element : productSearchClient.listReferenceImages(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -890,9 +928,9 @@ public final ListReferenceImagesPagedResponse listReferenceImages(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   ListReferenceImagesRequest request = ListReferenceImagesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListReferenceImagesPagedResponse> future = productSearchClient.listReferenceImagesPagedCallable().futureCall(request);
    *   // Do something
@@ -920,9 +958,9 @@ public final ListReferenceImagesPagedResponse listReferenceImages(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   ListReferenceImagesRequest request = ListReferenceImagesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListReferenceImagesResponse response = productSearchClient.listReferenceImagesCallable().call(request);
@@ -956,8 +994,39 @@ public final ListReferenceImagesPagedResponse listReferenceImages(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]");
-   *   ReferenceImage response = productSearchClient.getReferenceImage(formattedName);
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
+   *   ReferenceImage response = productSearchClient.getReferenceImage(name);
+   * }
+   * 
+ * + * @param name The resource name of the ReferenceImage to get. + *

Format is: + *

`projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReferenceImage getReferenceImage(ReferenceImageName name) { + + GetReferenceImageRequest request = + GetReferenceImageRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getReferenceImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information associated with a ReferenceImage. + * + *

Possible errors: + * + *

* Returns NOT_FOUND if the specified image does not exist. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
+   *   ReferenceImage response = productSearchClient.getReferenceImage(name.toString());
    * }
    * 
* @@ -967,7 +1036,7 @@ public final ListReferenceImagesPagedResponse listReferenceImages( * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ReferenceImage getReferenceImage(String name) { - IMAGE_PATH_TEMPLATE.validate(name, "getReferenceImage"); + GetReferenceImageRequest request = GetReferenceImageRequest.newBuilder().setName(name).build(); return getReferenceImage(request); } @@ -984,9 +1053,9 @@ public final ReferenceImage getReferenceImage(String name) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]");
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
    *   GetReferenceImageRequest request = GetReferenceImageRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ReferenceImage response = productSearchClient.getReferenceImage(request);
    * }
@@ -1011,9 +1080,9 @@ public final ReferenceImage getReferenceImage(GetReferenceImageRequest request)
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]");
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
    *   GetReferenceImageRequest request = GetReferenceImageRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<ReferenceImage> future = productSearchClient.getReferenceImageCallable().futureCall(request);
    *   // Do something
@@ -1042,8 +1111,44 @@ public final UnaryCallable getReferenc
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]");
-   *   productSearchClient.deleteReferenceImage(formattedName);
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
+   *   productSearchClient.deleteReferenceImage(name);
+   * }
+   * 
+ * + * @param name The resource name of the reference image to delete. + *

Format is: + *

`projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteReferenceImage(ReferenceImageName name) { + + DeleteReferenceImageRequest request = + DeleteReferenceImageRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteReferenceImage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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. + * + *

Possible errors: + * + *

* Returns NOT_FOUND if the reference image does not exist. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
+   *   productSearchClient.deleteReferenceImage(name.toString());
    * }
    * 
* @@ -1053,7 +1158,7 @@ public final UnaryCallable getReferenc * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteReferenceImage(String name) { - IMAGE_PATH_TEMPLATE.validate(name, "deleteReferenceImage"); + DeleteReferenceImageRequest request = DeleteReferenceImageRequest.newBuilder().setName(name).build(); deleteReferenceImage(request); @@ -1076,9 +1181,9 @@ public final void deleteReferenceImage(String name) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]");
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
    *   DeleteReferenceImageRequest request = DeleteReferenceImageRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   productSearchClient.deleteReferenceImage(request);
    * }
@@ -1108,9 +1213,9 @@ public final void deleteReferenceImage(DeleteReferenceImageRequest request) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]");
+   *   ReferenceImageName name = ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]");
    *   DeleteReferenceImageRequest request = DeleteReferenceImageRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = productSearchClient.deleteReferenceImageCallable().futureCall(request);
    *   // Do something
@@ -1118,8 +1223,61 @@ public final void deleteReferenceImage(DeleteReferenceImageRequest request) {
    * }
    * 
*/ - public final UnaryCallable deleteReferenceImageCallable() { - return stub.deleteReferenceImageCallable(); + public final UnaryCallable deleteReferenceImageCallable() { + return stub.deleteReferenceImageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
+   *   String referenceImageId = "";
+   *   ReferenceImage response = productSearchClient.createReferenceImage(parent, referenceImage, referenceImageId);
+   * }
+   * 
+ * + * @param parent Resource name of the product in which to create the reference image. + *

Format is `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param referenceImage The reference image to create. If an image ID is specified, it is + * ignored. + * @param referenceImageId 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 `/`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ReferenceImage createReferenceImage( + ProductName parent, ReferenceImage referenceImage, String referenceImageId) { + + CreateReferenceImageRequest request = + CreateReferenceImageRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setReferenceImage(referenceImage) + .setReferenceImageId(referenceImageId) + .build(); + return createReferenceImage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD @@ -1146,10 +1304,10 @@ public final UnaryCallable deleteReferenceIm * *


    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
    *   String referenceImageId = "";
-   *   ReferenceImage response = productSearchClient.createReferenceImage(formattedParent, referenceImage, referenceImageId);
+   *   ReferenceImage response = productSearchClient.createReferenceImage(parent.toString(), referenceImage, referenceImageId);
    * }
    * 
* @@ -1165,7 +1323,7 @@ public final UnaryCallable deleteReferenceIm */ public final ReferenceImage createReferenceImage( String parent, ReferenceImage referenceImage, String referenceImageId) { - PRODUCT_PATH_TEMPLATE.validate(parent, "createReferenceImage"); + CreateReferenceImageRequest request = CreateReferenceImageRequest.newBuilder() .setParent(parent) @@ -1199,10 +1357,10 @@ public final ReferenceImage createReferenceImage( * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
    *   CreateReferenceImageRequest request = CreateReferenceImageRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setReferenceImage(referenceImage)
    *     .build();
    *   ReferenceImage response = productSearchClient.createReferenceImage(request);
@@ -1240,10 +1398,10 @@ public final ReferenceImage createReferenceImage(CreateReferenceImageRequest req
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   ReferenceImage referenceImage = ReferenceImage.newBuilder().build();
    *   CreateReferenceImageRequest request = CreateReferenceImageRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setReferenceImage(referenceImage)
    *     .build();
    *   ApiFuture<ReferenceImage> future = productSearchClient.createReferenceImageCallable().futureCall(request);
@@ -1270,10 +1428,51 @@ public final ReferenceImage createReferenceImage(CreateReferenceImageRequest req
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ProductSet productSet = ProductSet.newBuilder().build();
+   *   String productSetId = "";
+   *   ProductSet response = productSearchClient.createProductSet(parent, productSet, productSetId);
+   * }
+   * 
+ * + * @param parent The project in which the ProductSet should be created. + *

Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param productSet The ProductSet to create. + * @param productSetId 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 `/`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ProductSet createProductSet( + LocationName parent, ProductSet productSet, String productSetId) { + + CreateProductSetRequest request = + CreateProductSetRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setProductSet(productSet) + .setProductSetId(productSetId) + .build(); + return createProductSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates and returns a new ProductSet resource. + * + *

Possible errors: + * + *

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

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ProductSet productSet = ProductSet.newBuilder().build();
    *   String productSetId = "";
-   *   ProductSet response = productSearchClient.createProductSet(formattedParent, productSet, productSetId);
+   *   ProductSet response = productSearchClient.createProductSet(parent.toString(), productSet, productSetId);
    * }
    * 
* @@ -1288,7 +1487,7 @@ public final ReferenceImage createReferenceImage(CreateReferenceImageRequest req */ public final ProductSet createProductSet( String parent, ProductSet productSet, String productSetId) { - LOCATION_PATH_TEMPLATE.validate(parent, "createProductSet"); + CreateProductSetRequest request = CreateProductSetRequest.newBuilder() .setParent(parent) @@ -1311,10 +1510,10 @@ public final ProductSet createProductSet( * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ProductSet productSet = ProductSet.newBuilder().build();
    *   CreateProductSetRequest request = CreateProductSetRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setProductSet(productSet)
    *     .build();
    *   ProductSet response = productSearchClient.createProductSet(request);
@@ -1341,10 +1540,10 @@ public final ProductSet createProductSet(CreateProductSetRequest request) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ProductSet productSet = ProductSet.newBuilder().build();
    *   CreateProductSetRequest request = CreateProductSetRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setProductSet(productSet)
    *     .build();
    *   ApiFuture<ProductSet> future = productSearchClient.createProductSetCallable().futureCall(request);
@@ -1369,8 +1568,39 @@ public final UnaryCallable createProductSet
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
-   *   for (ProductSet element : productSearchClient.listProductSets(formattedParent).iterateAll()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (ProductSet element : productSearchClient.listProductSets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent The project from which ProductSets should be listed. + *

Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListProductSetsPagedResponse listProductSets(LocationName parent) { + ListProductSetsRequest request = + ListProductSetsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listProductSets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists ProductSets in an unspecified order. + * + *

Possible errors: + * + *

* Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (ProductSet element : productSearchClient.listProductSets(parent.toString()).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -1381,7 +1611,6 @@ public final UnaryCallable createProductSet
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListProductSetsPagedResponse listProductSets(String parent) {
-    LOCATION_PATH_TEMPLATE.validate(parent, "listProductSets");
     ListProductSetsRequest request = ListProductSetsRequest.newBuilder().setParent(parent).build();
     return listProductSets(request);
   }
@@ -1398,9 +1627,9 @@ public final ListProductSetsPagedResponse listProductSets(String parent) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ListProductSetsRequest request = ListProductSetsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (ProductSet element : productSearchClient.listProductSets(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -1427,9 +1656,9 @@ public final ListProductSetsPagedResponse listProductSets(ListProductSetsRequest
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ListProductSetsRequest request = ListProductSetsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListProductSetsPagedResponse> future = productSearchClient.listProductSetsPagedCallable().futureCall(request);
    *   // Do something
@@ -1456,9 +1685,9 @@ public final ListProductSetsPagedResponse listProductSets(ListProductSetsRequest
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ListProductSetsRequest request = ListProductSetsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListProductSetsResponse response = productSearchClient.listProductSetsCallable().call(request);
@@ -1492,8 +1721,36 @@ public final ListProductSetsPagedResponse listProductSets(ListProductSetsRequest
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   ProductSet response = productSearchClient.getProductSet(formattedName);
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSet response = productSearchClient.getProductSet(name);
+   * }
+   * 
+ * + * @param name Resource name of the ProductSet to get. + *

Format is: `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ProductSet getProductSet(ProductSetName name) { + + GetProductSetRequest request = + GetProductSetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getProductSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information associated with a ProductSet. + * + *

Possible errors: + * + *

* Returns NOT_FOUND if the ProductSet does not exist. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSet response = productSearchClient.getProductSet(name.toString());
    * }
    * 
* @@ -1502,7 +1759,7 @@ public final ListProductSetsPagedResponse listProductSets(ListProductSetsRequest * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ProductSet getProductSet(String name) { - PRODUCT_SET_PATH_TEMPLATE.validate(name, "getProductSet"); + GetProductSetRequest request = GetProductSetRequest.newBuilder().setName(name).build(); return getProductSet(request); } @@ -1519,9 +1776,9 @@ public final ProductSet getProductSet(String name) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   GetProductSetRequest request = GetProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ProductSet response = productSearchClient.getProductSet(request);
    * }
@@ -1546,9 +1803,9 @@ public final ProductSet getProductSet(GetProductSetRequest request) {
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   GetProductSetRequest request = GetProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<ProductSet> future = productSearchClient.getProductSetCallable().futureCall(request);
    *   // Do something
@@ -1655,7 +1912,38 @@ public final UnaryCallable updateProductSet
 
   // AUTO-GENERATED DOCUMENTATION AND METHOD
   /**
-   * Permanently deletes a ProductSet. All Products and ReferenceImages in the ProductSet will be
+   * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not
+   * deleted.
+   *
+   * 

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

Possible errors: + * + *

* Returns NOT_FOUND if the ProductSet does not exist. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   productSearchClient.deleteProductSet(name);
+   * }
+   * 
+ * + * @param name Resource name of the ProductSet to delete. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteProductSet(ProductSetName name) { + + DeleteProductSetRequest request = + DeleteProductSetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteProductSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not * deleted. * *

The actual image files are not deleted from Google Cloud Storage. @@ -1668,8 +1956,8 @@ public final UnaryCallable updateProductSet * *


    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   productSearchClient.deleteProductSet(formattedName);
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   productSearchClient.deleteProductSet(name.toString());
    * }
    * 
* @@ -1678,14 +1966,14 @@ public final UnaryCallable updateProductSet * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteProductSet(String name) { - PRODUCT_SET_PATH_TEMPLATE.validate(name, "deleteProductSet"); + DeleteProductSetRequest request = DeleteProductSetRequest.newBuilder().setName(name).build(); deleteProductSet(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Permanently deletes a ProductSet. All Products and ReferenceImages in the ProductSet will be + * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not * deleted. * *

The actual image files are not deleted from Google Cloud Storage. @@ -1698,9 +1986,9 @@ public final void deleteProductSet(String name) { * *


    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   DeleteProductSetRequest request = DeleteProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   productSearchClient.deleteProductSet(request);
    * }
@@ -1715,7 +2003,7 @@ public final void deleteProductSet(DeleteProductSetRequest request) {
 
   // AUTO-GENERATED DOCUMENTATION AND METHOD
   /**
-   * Permanently deletes a ProductSet. All Products and ReferenceImages in the ProductSet will be
+   * Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not
    * deleted.
    *
    * 

The actual image files are not deleted from Google Cloud Storage. @@ -1728,9 +2016,9 @@ public final void deleteProductSet(DeleteProductSetRequest request) { * *


    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   DeleteProductSetRequest request = DeleteProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = productSearchClient.deleteProductSetCallable().futureCall(request);
    *   // Do something
@@ -1757,9 +2045,46 @@ public final UnaryCallable deleteProductSetCalla
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   String product = "";
-   *   productSearchClient.addProductToProductSet(formattedName, product);
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   productSearchClient.addProductToProductSet(name, product);
+   * }
+   * 
+ * + * @param name The resource name for the ProductSet to modify. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param product The resource name for the Product to be added to this ProductSet. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void addProductToProductSet(ProductSetName name, ProductName product) { + + AddProductToProductSetRequest request = + AddProductToProductSetRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setProduct(product == null ? null : product.toString()) + .build(); + addProductToProductSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * 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. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   productSearchClient.addProductToProductSet(name.toString(), product.toString());
    * }
    * 
* @@ -1770,7 +2095,7 @@ public final UnaryCallable deleteProductSetCalla * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void addProductToProductSet(String name, String product) { - PRODUCT_SET_PATH_TEMPLATE.validate(name, "addProductToProductSet"); + AddProductToProductSetRequest request = AddProductToProductSetRequest.newBuilder().setName(name).setProduct(product).build(); addProductToProductSet(request); @@ -1791,11 +2116,11 @@ public final void addProductToProductSet(String name, String product) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   String product = "";
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   AddProductToProductSetRequest request = AddProductToProductSetRequest.newBuilder()
-   *     .setName(formattedName)
-   *     .setProduct(product)
+   *     .setName(name.toString())
+   *     .setProduct(product.toString())
    *     .build();
    *   productSearchClient.addProductToProductSet(request);
    * }
@@ -1823,11 +2148,11 @@ public final void addProductToProductSet(AddProductToProductSetRequest request)
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   String product = "";
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   AddProductToProductSetRequest request = AddProductToProductSetRequest.newBuilder()
-   *     .setName(formattedName)
-   *     .setProduct(product)
+   *     .setName(name.toString())
+   *     .setProduct(product.toString())
    *     .build();
    *   ApiFuture<Void> future = productSearchClient.addProductToProductSetCallable().futureCall(request);
    *   // Do something
@@ -1852,9 +2177,43 @@ public final void addProductToProductSet(AddProductToProductSetRequest request)
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   String product = "";
-   *   productSearchClient.removeProductFromProductSet(formattedName, product);
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   productSearchClient.removeProductFromProductSet(name, product);
+   * }
+   * 
+ * + * @param name The resource name for the ProductSet to modify. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param product The resource name for the Product to be removed from this ProductSet. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void removeProductFromProductSet(ProductSetName name, ProductName product) { + + RemoveProductFromProductSetRequest request = + RemoveProductFromProductSetRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setProduct(product == null ? null : product.toString()) + .build(); + removeProductFromProductSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Removes a Product from the specified ProductSet. + * + *

Possible errors: + * + *

* Returns NOT_FOUND If the Product is not found under the ProductSet. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
+   *   productSearchClient.removeProductFromProductSet(name.toString(), product.toString());
    * }
    * 
* @@ -1865,7 +2224,7 @@ public final void addProductToProductSet(AddProductToProductSetRequest request) * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void removeProductFromProductSet(String name, String product) { - PRODUCT_SET_PATH_TEMPLATE.validate(name, "removeProductFromProductSet"); + RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder().setName(name).setProduct(product).build(); removeProductFromProductSet(request); @@ -1883,11 +2242,11 @@ public final void removeProductFromProductSet(String name, String product) { * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   String product = "";
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder()
-   *     .setName(formattedName)
-   *     .setProduct(product)
+   *     .setName(name.toString())
+   *     .setProduct(product.toString())
    *     .build();
    *   productSearchClient.removeProductFromProductSet(request);
    * }
@@ -1912,11 +2271,11 @@ public final void removeProductFromProductSet(RemoveProductFromProductSetRequest
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   String product = "";
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]");
    *   RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder()
-   *     .setName(formattedName)
-   *     .setProduct(product)
+   *     .setName(name.toString())
+   *     .setProduct(product.toString())
    *     .build();
    *   ApiFuture<Void> future = productSearchClient.removeProductFromProductSetCallable().futureCall(request);
    *   // Do something
@@ -1942,8 +2301,40 @@ public final void removeProductFromProductSet(RemoveProductFromProductSetRequest
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
-   *   for (Product element : productSearchClient.listProductsInProductSet(formattedName).iterateAll()) {
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   for (Product element : productSearchClient.listProductsInProductSet(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The ProductSet resource for which to retrieve Products. + *

Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListProductsInProductSetPagedResponse listProductsInProductSet(ProductSetName name) { + ListProductsInProductSetRequest request = + ListProductsInProductSetRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listProductsInProductSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, + * the products field of the response will be empty. + * + *

Possible errors: + * + *

* Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   for (Product element : productSearchClient.listProductsInProductSet(name.toString()).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -1954,7 +2345,6 @@ public final void removeProductFromProductSet(RemoveProductFromProductSetRequest
    * @throws com.google.api.gax.rpc.ApiException if the remote call fails
    */
   public final ListProductsInProductSetPagedResponse listProductsInProductSet(String name) {
-    PRODUCT_SET_PATH_TEMPLATE.validate(name, "listProductsInProductSet");
     ListProductsInProductSetRequest request =
         ListProductsInProductSetRequest.newBuilder().setName(name).build();
     return listProductsInProductSet(request);
@@ -1973,9 +2363,9 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet(Stri
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   ListProductsInProductSetRequest request = ListProductsInProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   for (Product element : productSearchClient.listProductsInProductSet(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -2004,9 +2394,9 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   ListProductsInProductSetRequest request = ListProductsInProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<ListProductsInProductSetPagedResponse> future = productSearchClient.listProductsInProductSetPagedCallable().futureCall(request);
    *   // Do something
@@ -2034,9 +2424,9 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedName = ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
+   *   ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]");
    *   ListProductsInProductSetRequest request = ListProductsInProductSetRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   while (true) {
    *     ListProductsInProductSetResponse response = productSearchClient.listProductsInProductSetCallable().call(request);
@@ -2076,9 +2466,51 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
+   *   ImportProductSetsResponse response = productSearchClient.importProductSetsAsync(parent, inputConfig).get();
+   * }
+   * 
+ * + * @param parent The project in which the ProductSets should be imported. + *

Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param inputConfig The input content for the list of requests. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + importProductSetsAsync(LocationName parent, ImportProductSetsInputConfig inputConfig) { + + ImportProductSetsRequest request = + ImportProductSetsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setInputConfig(inputConfig) + .build(); + return importProductSetsAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Asynchronous API that imports a list of reference images to specified product sets based on a + * list of image information. + * + *

The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep + * track of the progress and results of the request. `Operation.metadata` contains + * `BatchOperationMetadata`. (progress) `Operation.response` contains `ImportProductSetsResponse`. + * (results) + * + *

The input source of this method is a csv file on Google Cloud Storage. For the format of the + * csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + * + *

Sample code: + * + *


+   * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
-   *   ImportProductSetsResponse response = productSearchClient.importProductSetsAsync(formattedParent, inputConfig).get();
+   *   ImportProductSetsResponse response = productSearchClient.importProductSetsAsync(parent.toString(), inputConfig).get();
    * }
    * 
* @@ -2091,7 +2523,7 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture importProductSetsAsync(String parent, ImportProductSetsInputConfig inputConfig) { - LOCATION_PATH_TEMPLATE.validate(parent, "importProductSets"); + ImportProductSetsRequest request = ImportProductSetsRequest.newBuilder().setParent(parent).setInputConfig(inputConfig).build(); return importProductSetsAsync(request); @@ -2115,10 +2547,10 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet( * *

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
    *   ImportProductSetsRequest request = ImportProductSetsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setInputConfig(inputConfig)
    *     .build();
    *   ImportProductSetsResponse response = productSearchClient.importProductSetsAsync(request).get();
@@ -2153,10 +2585,10 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
    *   ImportProductSetsRequest request = ImportProductSetsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setInputConfig(inputConfig)
    *     .build();
    *   OperationFuture<Operation> future = productSearchClient.importProductSetsOperationCallable().futureCall(request);
@@ -2190,10 +2622,10 @@ public final ListProductsInProductSetPagedResponse listProductsInProductSet(
    *
    * 

    * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
-   *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    *   ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build();
    *   ImportProductSetsRequest request = ImportProductSetsRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setInputConfig(inputConfig)
    *     .build();
    *   ApiFuture<Operation> future = productSearchClient.importProductSetsCallable().futureCall(request);
diff --git a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/package-info.java b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/package-info.java
index 0567a3e2cfdb..ca290c93c44a 100644
--- a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/package-info.java
+++ b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/package-info.java
@@ -42,10 +42,10 @@
  * 
  * 
  * try (ProductSearchClient productSearchClient = ProductSearchClient.create()) {
- *   String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]");
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
  *   Product product = Product.newBuilder().build();
  *   String productId = "";
- *   Product response = productSearchClient.createProduct(formattedParent, product, productId);
+ *   Product response = productSearchClient.createProduct(parent, product, productId);
  * }
  * 
  * 
diff --git a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/stub/ProductSearchStubSettings.java b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/stub/ProductSearchStubSettings.java index 8b07632c28ad..25ba610a2f26 100644 --- a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/stub/ProductSearchStubSettings.java +++ b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/stub/ProductSearchStubSettings.java @@ -385,7 +385,9 @@ public String extractNextToken(ListProductsResponse payload) { @Override public Iterable extractResources(ListProductsResponse payload) { - return payload.getProductsList(); + return payload.getProductsList() != null + ? payload.getProductsList() + : ImmutableList.of(); } }; @@ -423,7 +425,9 @@ public String extractNextToken(ListReferenceImagesResponse payload) { @Override public Iterable extractResources(ListReferenceImagesResponse payload) { - return payload.getReferenceImagesList(); + return payload.getReferenceImagesList() != null + ? payload.getReferenceImagesList() + : ImmutableList.of(); } }; @@ -460,7 +464,9 @@ public String extractNextToken(ListProductSetsResponse payload) { @Override public Iterable extractResources(ListProductSetsResponse payload) { - return payload.getProductSetsList(); + return payload.getProductSetsList() != null + ? payload.getProductSetsList() + : ImmutableList.of(); } }; @@ -502,7 +508,9 @@ public String extractNextToken(ListProductsInProductSetResponse payload) { @Override public Iterable extractResources(ListProductsInProductSetResponse payload) { - return payload.getProductsList(); + return payload.getProductsList() != null + ? payload.getProductsList() + : ImmutableList.of(); } }; diff --git a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p3beta1/stub/ProductSearchStubSettings.java b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p3beta1/stub/ProductSearchStubSettings.java index e527051af7fb..28391ec035c7 100644 --- a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p3beta1/stub/ProductSearchStubSettings.java +++ b/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p3beta1/stub/ProductSearchStubSettings.java @@ -389,7 +389,9 @@ public String extractNextToken(ListProductSetsResponse payload) { @Override public Iterable extractResources(ListProductSetsResponse payload) { - return payload.getProductSetsList(); + return payload.getProductSetsList() != null + ? payload.getProductSetsList() + : ImmutableList.of(); } }; @@ -423,7 +425,9 @@ public String extractNextToken(ListProductsResponse payload) { @Override public Iterable extractResources(ListProductsResponse payload) { - return payload.getProductsList(); + return payload.getProductsList() != null + ? payload.getProductsList() + : ImmutableList.of(); } }; @@ -461,7 +465,9 @@ public String extractNextToken(ListReferenceImagesResponse payload) { @Override public Iterable extractResources(ListReferenceImagesResponse payload) { - return payload.getReferenceImagesList(); + return payload.getReferenceImagesList() != null + ? payload.getReferenceImagesList() + : ImmutableList.of(); } }; @@ -503,7 +509,9 @@ public String extractNextToken(ListProductsInProductSetResponse payload) { @Override public Iterable extractResources(ListProductsInProductSetResponse payload) { - return payload.getProductsList(); + return payload.getProductsList() != null + ? payload.getProductsList() + : ImmutableList.of(); } }; diff --git a/google-cloud-clients/google-cloud-vision/src/test/java/com/google/cloud/vision/v1/ProductSearchClientTest.java b/google-cloud-clients/google-cloud-vision/src/test/java/com/google/cloud/vision/v1/ProductSearchClientTest.java index 485361f93dc7..0fa690acdf5e 100644 --- a/google-cloud-clients/google-cloud-vision/src/test/java/com/google/cloud/vision/v1/ProductSearchClientTest.java +++ b/google-cloud-clients/google-cloud-vision/src/test/java/com/google/cloud/vision/v1/ProductSearchClientTest.java @@ -90,31 +90,31 @@ public void tearDown() throws Exception { @Test @SuppressWarnings("all") public void createProductTest() { - String name = "name3373707"; + ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); String displayName = "displayName1615086568"; String description = "description-1724546052"; String productCategory = "productCategory-1607451058"; Product expectedResponse = Product.newBuilder() - .setName(name) + .setName(name.toString()) .setDisplayName(displayName) .setDescription(description) .setProductCategory(productCategory) .build(); mockProductSearch.addResponse(expectedResponse); - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Product product = Product.newBuilder().build(); String productId = "productId1753008747"; - Product actualResponse = client.createProduct(formattedParent, product, productId); + Product actualResponse = client.createProduct(parent, product, productId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateProductRequest actualRequest = (CreateProductRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertEquals(product, actualRequest.getProduct()); Assert.assertEquals(productId, actualRequest.getProductId()); Assert.assertTrue( @@ -130,11 +130,11 @@ public void createProductExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Product product = Product.newBuilder().build(); String productId = "productId1753008747"; - client.createProduct(formattedParent, product, productId); + client.createProduct(parent, product, productId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -154,9 +154,9 @@ public void listProductsTest() { .build(); mockProductSearch.addResponse(expectedResponse); - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - ListProductsPagedResponse pagedListResponse = client.listProducts(formattedParent); + ListProductsPagedResponse pagedListResponse = client.listProducts(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -166,7 +166,7 @@ public void listProductsTest() { Assert.assertEquals(1, actualRequests.size()); ListProductsRequest actualRequest = (ListProductsRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -180,9 +180,9 @@ public void listProductsExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - client.listProducts(formattedParent); + client.listProducts(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -192,30 +192,29 @@ public void listProductsExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getProductTest() { - String name2 = "name2-1052831874"; + ProductName name2 = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); String displayName = "displayName1615086568"; String description = "description-1724546052"; String productCategory = "productCategory-1607451058"; Product expectedResponse = Product.newBuilder() - .setName(name2) + .setName(name2.toString()) .setDisplayName(displayName) .setDescription(description) .setProductCategory(productCategory) .build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - Product actualResponse = client.getProduct(formattedName); + Product actualResponse = client.getProduct(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetProductRequest actualRequest = (GetProductRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ProductName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -229,10 +228,9 @@ public void getProductExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.getProduct(formattedName); + client.getProduct(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -242,13 +240,13 @@ public void getProductExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void updateProductTest() { - String name = "name3373707"; + ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); String displayName = "displayName1615086568"; String description = "description-1724546052"; String productCategory = "productCategory-1607451058"; Product expectedResponse = Product.newBuilder() - .setName(name) + .setName(name.toString()) .setDisplayName(displayName) .setDescription(description) .setProductCategory(productCategory) @@ -296,16 +294,15 @@ public void deleteProductTest() { Empty expectedResponse = Empty.newBuilder().build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.deleteProduct(formattedName); + client.deleteProduct(name); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteProductRequest actualRequest = (DeleteProductRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ProductName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -319,10 +316,9 @@ public void deleteProductExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName name = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.deleteProduct(formattedName); + client.deleteProduct(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -344,11 +340,9 @@ public void listReferenceImagesTest() { .build(); mockProductSearch.addResponse(expectedResponse); - String formattedParent = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - ListReferenceImagesPagedResponse pagedListResponse = - client.listReferenceImages(formattedParent); + ListReferenceImagesPagedResponse pagedListResponse = client.listReferenceImages(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -358,7 +352,7 @@ public void listReferenceImagesTest() { Assert.assertEquals(1, actualRequests.size()); ListReferenceImagesRequest actualRequest = (ListReferenceImagesRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProductName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -372,10 +366,9 @@ public void listReferenceImagesExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.listReferenceImages(formattedParent); + client.listReferenceImages(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -385,23 +378,24 @@ public void listReferenceImagesExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getReferenceImageTest() { - String name2 = "name2-1052831874"; + ReferenceImageName name2 = + ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]"); String uri = "uri116076"; ReferenceImage expectedResponse = - ReferenceImage.newBuilder().setName(name2).setUri(uri).build(); + ReferenceImage.newBuilder().setName(name2.toString()).setUri(uri).build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]"); + ReferenceImageName name = + ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]"); - ReferenceImage actualResponse = client.getReferenceImage(formattedName); + ReferenceImage actualResponse = client.getReferenceImage(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetReferenceImageRequest actualRequest = (GetReferenceImageRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ReferenceImageName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -415,10 +409,10 @@ public void getReferenceImageExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]"); + ReferenceImageName name = + ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]"); - client.getReferenceImage(formattedName); + client.getReferenceImage(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -431,16 +425,16 @@ public void deleteReferenceImageTest() { Empty expectedResponse = Empty.newBuilder().build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]"); + ReferenceImageName name = + ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]"); - client.deleteReferenceImage(formattedName); + client.deleteReferenceImage(name); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteReferenceImageRequest actualRequest = (DeleteReferenceImageRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ReferenceImageName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -454,10 +448,10 @@ public void deleteReferenceImageExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatImageName("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[IMAGE]"); + ReferenceImageName name = + ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]"); - client.deleteReferenceImage(formattedName); + client.deleteReferenceImage(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -467,25 +461,26 @@ public void deleteReferenceImageExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void createReferenceImageTest() { - String name = "name3373707"; + ReferenceImageName name = + ReferenceImageName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]", "[REFERENCE_IMAGE]"); String uri = "uri116076"; - ReferenceImage expectedResponse = ReferenceImage.newBuilder().setName(name).setUri(uri).build(); + ReferenceImage expectedResponse = + ReferenceImage.newBuilder().setName(name.toString()).setUri(uri).build(); mockProductSearch.addResponse(expectedResponse); - String formattedParent = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); ReferenceImage referenceImage = ReferenceImage.newBuilder().build(); String referenceImageId = "referenceImageId1946713331"; ReferenceImage actualResponse = - client.createReferenceImage(formattedParent, referenceImage, referenceImageId); + client.createReferenceImage(parent, referenceImage, referenceImageId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateReferenceImageRequest actualRequest = (CreateReferenceImageRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, ProductName.parse(actualRequest.getParent())); Assert.assertEquals(referenceImage, actualRequest.getReferenceImage()); Assert.assertEquals(referenceImageId, actualRequest.getReferenceImageId()); Assert.assertTrue( @@ -501,12 +496,11 @@ public void createReferenceImageExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = - ProductSearchClient.formatProductName("[PROJECT]", "[LOCATION]", "[PRODUCT]"); + ProductName parent = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); ReferenceImage referenceImage = ReferenceImage.newBuilder().build(); String referenceImageId = "referenceImageId1946713331"; - client.createReferenceImage(formattedParent, referenceImage, referenceImageId); + client.createReferenceImage(parent, referenceImage, referenceImageId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -516,24 +510,24 @@ public void createReferenceImageExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void createProductSetTest() { - String name = "name3373707"; + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); String displayName = "displayName1615086568"; ProductSet expectedResponse = - ProductSet.newBuilder().setName(name).setDisplayName(displayName).build(); + ProductSet.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); mockProductSearch.addResponse(expectedResponse); - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ProductSet productSet = ProductSet.newBuilder().build(); String productSetId = "productSetId4216680"; - ProductSet actualResponse = client.createProductSet(formattedParent, productSet, productSetId); + ProductSet actualResponse = client.createProductSet(parent, productSet, productSetId); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateProductSetRequest actualRequest = (CreateProductSetRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertEquals(productSet, actualRequest.getProductSet()); Assert.assertEquals(productSetId, actualRequest.getProductSetId()); Assert.assertTrue( @@ -549,11 +543,11 @@ public void createProductSetExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ProductSet productSet = ProductSet.newBuilder().build(); String productSetId = "productSetId4216680"; - client.createProductSet(formattedParent, productSet, productSetId); + client.createProductSet(parent, productSet, productSetId); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -573,9 +567,9 @@ public void listProductSetsTest() { .build(); mockProductSearch.addResponse(expectedResponse); - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - ListProductSetsPagedResponse pagedListResponse = client.listProductSets(formattedParent); + ListProductSetsPagedResponse pagedListResponse = client.listProductSets(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -585,7 +579,7 @@ public void listProductSetsTest() { Assert.assertEquals(1, actualRequests.size()); ListProductSetsRequest actualRequest = (ListProductSetsRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -599,9 +593,9 @@ public void listProductSetsExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - client.listProductSets(formattedParent); + client.listProductSets(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -611,23 +605,22 @@ public void listProductSetsExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getProductSetTest() { - String name2 = "name2-1052831874"; + ProductSetName name2 = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); String displayName = "displayName1615086568"; ProductSet expectedResponse = - ProductSet.newBuilder().setName(name2).setDisplayName(displayName).build(); + ProductSet.newBuilder().setName(name2.toString()).setDisplayName(displayName).build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - ProductSet actualResponse = client.getProductSet(formattedName); + ProductSet actualResponse = client.getProductSet(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetProductSetRequest actualRequest = (GetProductSetRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ProductSetName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -641,10 +634,9 @@ public void getProductSetExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - client.getProductSet(formattedName); + client.getProductSet(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -654,10 +646,10 @@ public void getProductSetExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void updateProductSetTest() { - String name = "name3373707"; + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); String displayName = "displayName1615086568"; ProductSet expectedResponse = - ProductSet.newBuilder().setName(name).setDisplayName(displayName).build(); + ProductSet.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); mockProductSearch.addResponse(expectedResponse); ProductSet productSet = ProductSet.newBuilder().build(); @@ -701,16 +693,15 @@ public void deleteProductSetTest() { Empty expectedResponse = Empty.newBuilder().build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - client.deleteProductSet(formattedName); + client.deleteProductSet(name); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteProductSetRequest actualRequest = (DeleteProductSetRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ProductSetName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -724,10 +715,9 @@ public void deleteProductSetExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - client.deleteProductSet(formattedName); + client.deleteProductSet(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -740,19 +730,18 @@ public void addProductToProductSetTest() { Empty expectedResponse = Empty.newBuilder().build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - String product = "product-309474065"; + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.addProductToProductSet(formattedName, product); + client.addProductToProductSet(name, product); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); AddProductToProductSetRequest actualRequest = (AddProductToProductSetRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); - Assert.assertEquals(product, actualRequest.getProduct()); + Assert.assertEquals(name, ProductSetName.parse(actualRequest.getName())); + Assert.assertEquals(product, ProductName.parse(actualRequest.getProduct())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -766,11 +755,10 @@ public void addProductToProductSetExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - String product = "product-309474065"; + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.addProductToProductSet(formattedName, product); + client.addProductToProductSet(name, product); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -783,19 +771,18 @@ public void removeProductFromProductSetTest() { Empty expectedResponse = Empty.newBuilder().build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - String product = "product-309474065"; + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.removeProductFromProductSet(formattedName, product); + client.removeProductFromProductSet(name, product); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); RemoveProductFromProductSetRequest actualRequest = (RemoveProductFromProductSetRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); - Assert.assertEquals(product, actualRequest.getProduct()); + Assert.assertEquals(name, ProductSetName.parse(actualRequest.getName())); + Assert.assertEquals(product, ProductName.parse(actualRequest.getProduct())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -809,11 +796,10 @@ public void removeProductFromProductSetExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - String product = "product-309474065"; + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); - client.removeProductFromProductSet(formattedName, product); + client.removeProductFromProductSet(name, product); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -833,11 +819,9 @@ public void listProductsInProductSetTest() { .build(); mockProductSearch.addResponse(expectedResponse); - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - ListProductsInProductSetPagedResponse pagedListResponse = - client.listProductsInProductSet(formattedName); + ListProductsInProductSetPagedResponse pagedListResponse = client.listProductsInProductSet(name); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -848,7 +832,7 @@ public void listProductsInProductSetTest() { ListProductsInProductSetRequest actualRequest = (ListProductsInProductSetRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, ProductSetName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -862,10 +846,9 @@ public void listProductsInProductSetExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedName = - ProductSearchClient.formatProductSetName("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); + ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); - client.listProductsInProductSet(formattedName); + client.listProductsInProductSet(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -884,18 +867,18 @@ public void importProductSetsTest() throws Exception { .build(); mockProductSearch.addResponse(resultOperation); - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build(); ImportProductSetsResponse actualResponse = - client.importProductSetsAsync(formattedParent, inputConfig).get(); + client.importProductSetsAsync(parent, inputConfig).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); ImportProductSetsRequest actualRequest = (ImportProductSetsRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertEquals(inputConfig, actualRequest.getInputConfig()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -910,10 +893,10 @@ public void importProductSetsExceptionTest() throws Exception { mockProductSearch.addException(exception); try { - String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ImportProductSetsInputConfig inputConfig = ImportProductSetsInputConfig.newBuilder().build(); - client.importProductSetsAsync(formattedParent, inputConfig).get(); + client.importProductSetsAsync(parent, inputConfig).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());