From d97deac68e1d1ed78a77de0fe9f7f1231aeb1d7c Mon Sep 17 00:00:00 2001 From: DPE bot Date: Wed, 7 Nov 2018 11:25:28 -0800 Subject: [PATCH] Add support for Cloud Vision Product Search (#1385) --- Vision/metadata/V1/Geometry.php | 1 + Vision/metadata/V1/ImageAnnotator.php | 501 +++--- Vision/metadata/V1/ProductSearch.php | 59 + Vision/metadata/V1/ProductSearchService.php | 248 +++ .../src/V1/AddProductToProductSetRequest.php | 117 ++ Vision/src/V1/AnnotateImageResponse.php | 34 + Vision/src/V1/BatchOperationMetadata.php | 141 ++ .../src/V1/BatchOperationMetadata/State.php | 51 + .../src/V1/BatchOperationMetadata_State.php | 16 + Vision/src/V1/CreateProductRequest.php | 155 ++ Vision/src/V1/CreateProductSetRequest.php | 151 ++ Vision/src/V1/CreateReferenceImageRequest.php | 159 ++ Vision/src/V1/DeleteProductRequest.php | 75 + Vision/src/V1/DeleteProductSetRequest.php | 75 + Vision/src/V1/DeleteReferenceImageRequest.php | 75 + Vision/src/V1/EntityAnnotation.php | 6 +- Vision/src/V1/Feature/Type.php | 6 + .../src/V1/Gapic/ProductSearchGapicClient.php | 1589 +++++++++++++++++ Vision/src/V1/GetProductRequest.php | 75 + Vision/src/V1/GetProductSetRequest.php | 75 + Vision/src/V1/GetReferenceImageRequest.php | 75 + Vision/src/V1/ImageAnnotatorGrpcClient.php | 3 +- Vision/src/V1/ImageContext.php | 34 + Vision/src/V1/ImportProductSetsGcsSource.php | 252 +++ .../src/V1/ImportProductSetsInputConfig.php | 73 + Vision/src/V1/ImportProductSetsRequest.php | 105 ++ Vision/src/V1/ImportProductSetsResponse.php | 120 ++ Vision/src/V1/ListProductSetsRequest.php | 139 ++ Vision/src/V1/ListProductSetsResponse.php | 105 ++ .../V1/ListProductsInProductSetRequest.php | 143 ++ .../V1/ListProductsInProductSetResponse.php | 105 ++ Vision/src/V1/ListProductsRequest.php | 143 ++ Vision/src/V1/ListProductsResponse.php | 105 ++ Vision/src/V1/ListReferenceImagesRequest.php | 151 ++ Vision/src/V1/ListReferenceImagesResponse.php | 135 ++ Vision/src/V1/Product.php | 255 +++ Vision/src/V1/Product/KeyValue.php | 112 ++ Vision/src/V1/ProductSearchClient.php | 38 + Vision/src/V1/ProductSearchGrpcClient.php | 431 +++++ Vision/src/V1/ProductSearchParams.php | 205 +++ Vision/src/V1/ProductSearchResults.php | 151 ++ .../V1/ProductSearchResults/GroupedResult.php | 105 ++ Vision/src/V1/ProductSearchResults/Result.php | 146 ++ .../V1/ProductSearchResults_GroupedResult.php | 16 + Vision/src/V1/ProductSearchResults_Result.php | 16 + Vision/src/V1/ProductSet.php | 207 +++ Vision/src/V1/Product_KeyValue.php | 16 + Vision/src/V1/ReferenceImage.php | 180 ++ .../V1/RemoveProductFromProductSetRequest.php | 117 ++ Vision/src/V1/UpdateProductRequest.php | 121 ++ Vision/src/V1/UpdateProductSetRequest.php | 113 ++ Vision/src/V1/WebDetection.php | 12 +- .../product_search_client_config.json | 116 ++ .../product_search_descriptor_config.php | 58 + .../product_search_rest_client_config.php | 235 +++ .../tests/Unit/V1/ProductSearchClientTest.php | 1522 ++++++++++++++++ docs/contents/cloud-vision.json | 3 + 57 files changed, 9218 insertions(+), 254 deletions(-) create mode 100644 Vision/metadata/V1/ProductSearch.php create mode 100644 Vision/metadata/V1/ProductSearchService.php create mode 100644 Vision/src/V1/AddProductToProductSetRequest.php create mode 100644 Vision/src/V1/BatchOperationMetadata.php create mode 100644 Vision/src/V1/BatchOperationMetadata/State.php create mode 100644 Vision/src/V1/BatchOperationMetadata_State.php create mode 100644 Vision/src/V1/CreateProductRequest.php create mode 100644 Vision/src/V1/CreateProductSetRequest.php create mode 100644 Vision/src/V1/CreateReferenceImageRequest.php create mode 100644 Vision/src/V1/DeleteProductRequest.php create mode 100644 Vision/src/V1/DeleteProductSetRequest.php create mode 100644 Vision/src/V1/DeleteReferenceImageRequest.php create mode 100644 Vision/src/V1/Gapic/ProductSearchGapicClient.php create mode 100644 Vision/src/V1/GetProductRequest.php create mode 100644 Vision/src/V1/GetProductSetRequest.php create mode 100644 Vision/src/V1/GetReferenceImageRequest.php create mode 100644 Vision/src/V1/ImportProductSetsGcsSource.php create mode 100644 Vision/src/V1/ImportProductSetsInputConfig.php create mode 100644 Vision/src/V1/ImportProductSetsRequest.php create mode 100644 Vision/src/V1/ImportProductSetsResponse.php create mode 100644 Vision/src/V1/ListProductSetsRequest.php create mode 100644 Vision/src/V1/ListProductSetsResponse.php create mode 100644 Vision/src/V1/ListProductsInProductSetRequest.php create mode 100644 Vision/src/V1/ListProductsInProductSetResponse.php create mode 100644 Vision/src/V1/ListProductsRequest.php create mode 100644 Vision/src/V1/ListProductsResponse.php create mode 100644 Vision/src/V1/ListReferenceImagesRequest.php create mode 100644 Vision/src/V1/ListReferenceImagesResponse.php create mode 100644 Vision/src/V1/Product.php create mode 100644 Vision/src/V1/Product/KeyValue.php create mode 100644 Vision/src/V1/ProductSearchClient.php create mode 100644 Vision/src/V1/ProductSearchGrpcClient.php create mode 100644 Vision/src/V1/ProductSearchParams.php create mode 100644 Vision/src/V1/ProductSearchResults.php create mode 100644 Vision/src/V1/ProductSearchResults/GroupedResult.php create mode 100644 Vision/src/V1/ProductSearchResults/Result.php create mode 100644 Vision/src/V1/ProductSearchResults_GroupedResult.php create mode 100644 Vision/src/V1/ProductSearchResults_Result.php create mode 100644 Vision/src/V1/ProductSet.php create mode 100644 Vision/src/V1/Product_KeyValue.php create mode 100644 Vision/src/V1/ReferenceImage.php create mode 100644 Vision/src/V1/RemoveProductFromProductSetRequest.php create mode 100644 Vision/src/V1/UpdateProductRequest.php create mode 100644 Vision/src/V1/UpdateProductSetRequest.php create mode 100644 Vision/src/V1/resources/product_search_client_config.json create mode 100644 Vision/src/V1/resources/product_search_descriptor_config.php create mode 100644 Vision/src/V1/resources/product_search_rest_client_config.php create mode 100644 Vision/tests/Unit/V1/ProductSearchClientTest.php diff --git a/Vision/metadata/V1/Geometry.php b/Vision/metadata/V1/Geometry.php index cf86cc300df8..2f1bd2310619 100644 --- a/Vision/metadata/V1/Geometry.php +++ b/Vision/metadata/V1/Geometry.php @@ -14,6 +14,7 @@ public static function initOnce() { if (static::$is_initialized == true) { return; } + \GPBMetadata\Google\Api\Annotations::initOnce(); $pool->internalAddGeneratedFile(hex2bin( "0abf030a25676f6f676c652f636c6f75642f766973696f6e2f76312f6765" . "6f6d657472792e70726f746f1216676f6f676c652e636c6f75642e766973" . diff --git a/Vision/metadata/V1/ImageAnnotator.php b/Vision/metadata/V1/ImageAnnotator.php index 90da7de501ec..318520a1214c 100644 --- a/Vision/metadata/V1/ImageAnnotator.php +++ b/Vision/metadata/V1/ImageAnnotator.php @@ -16,6 +16,7 @@ public static function initOnce() { } \GPBMetadata\Google\Api\Annotations::initOnce(); \GPBMetadata\Google\Cloud\Vision\V1\Geometry::initOnce(); + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); \GPBMetadata\Google\Cloud\Vision\V1\TextAnnotation::initOnce(); \GPBMetadata\Google\Cloud\Vision\V1\WebDetection::initOnce(); \GPBMetadata\Google\Longrunning\Operations::initOnce(); @@ -24,256 +25,264 @@ public static function initOnce() { \GPBMetadata\Google\Type\Color::initOnce(); \GPBMetadata\Google\Type\Latlng::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ac33a0a2c676f6f676c652f636c6f75642f766973696f6e2f76312f696d" . + "0aa23c0a2c676f6f676c652f636c6f75642f766973696f6e2f76312f696d" . "6167655f616e6e6f7461746f722e70726f746f1216676f6f676c652e636c" . "6f75642e766973696f6e2e76311a25676f6f676c652f636c6f75642f7669" . - "73696f6e2f76312f67656f6d657472792e70726f746f1a2c676f6f676c65" . - "2f636c6f75642f766973696f6e2f76312f746578745f616e6e6f74617469" . - "6f6e2e70726f746f1a2a676f6f676c652f636c6f75642f766973696f6e2f" . - "76312f7765625f646574656374696f6e2e70726f746f1a23676f6f676c65" . - "2f6c6f6e6772756e6e696e672f6f7065726174696f6e732e70726f746f1a" . - "1f676f6f676c652f70726f746f6275662f74696d657374616d702e70726f" . - "746f1a17676f6f676c652f7270632f7374617475732e70726f746f1a1767" . - "6f6f676c652f747970652f636f6c6f722e70726f746f1a18676f6f676c65" . - "2f747970652f6c61746c6e672e70726f746f22f3020a0746656174757265" . - "12320a047479706518012001280e32242e676f6f676c652e636c6f75642e" . - "766973696f6e2e76312e466561747572652e5479706512130a0b6d61785f" . - "726573756c7473180220012805120d0a056d6f64656c180320012809228f" . - "020a045479706512140a10545950455f554e535045434946494544100012" . - "120a0e464143455f444554454354494f4e100112160a124c414e444d4152" . - "4b5f444554454354494f4e100212120a0e4c4f474f5f444554454354494f" . - "4e100312130a0f4c4142454c5f444554454354494f4e100412120a0e5445" . - "58545f444554454354494f4e1005121b0a17444f43554d454e545f544558" . - "545f444554454354494f4e100b12190a15534146455f5345415243485f44" . - "4554454354494f4e100612140a10494d4147455f50524f50455254494553" . - "1007120e0a0a43524f505f48494e5453100912110a0d5745425f44455445" . - "4354494f4e100a12170a134f424a4543545f4c4f43414c495a4154494f4e" . - "101322370a0b496d616765536f7572636512150a0d6763735f696d616765" . - "5f75726918012001280912110a09696d6167655f75726918022001280922" . - "4d0a05496d616765120f0a07636f6e74656e7418012001280c12330a0673" . - "6f7572636518022001280b32232e676f6f676c652e636c6f75642e766973" . - "696f6e2e76312e496d616765536f7572636522c70d0a0e46616365416e6e" . - "6f746174696f6e123b0a0d626f756e64696e675f706f6c7918012001280b" . - "32242e676f6f676c652e636c6f75642e766973696f6e2e76312e426f756e" . - "64696e67506f6c79123e0a1066645f626f756e64696e675f706f6c791802" . - "2001280b32242e676f6f676c652e636c6f75642e766973696f6e2e76312e" . - "426f756e64696e67506f6c7912420a096c616e646d61726b731803200328" . - "0b322f2e676f6f676c652e636c6f75642e766973696f6e2e76312e466163" . - "65416e6e6f746174696f6e2e4c616e646d61726b12120a0a726f6c6c5f61" . - "6e676c6518042001280212110a0970616e5f616e676c6518052001280212" . - "120a0a74696c745f616e676c65180620012802121c0a1464657465637469" . - "6f6e5f636f6e666964656e6365180720012802121e0a166c616e646d6172" . - "6b696e675f636f6e666964656e6365180820012802123a0a0e6a6f795f6c" . - "696b656c69686f6f6418092001280e32222e676f6f676c652e636c6f7564" . - "2e766973696f6e2e76312e4c696b656c69686f6f64123d0a11736f72726f" . - "775f6c696b656c69686f6f64180a2001280e32222e676f6f676c652e636c" . - "6f75642e766973696f6e2e76312e4c696b656c69686f6f64123c0a10616e" . - "6765725f6c696b656c69686f6f64180b2001280e32222e676f6f676c652e" . - "636c6f75642e766973696f6e2e76312e4c696b656c69686f6f64123f0a13" . - "73757270726973655f6c696b656c69686f6f64180c2001280e32222e676f" . + "73696f6e2f76312f67656f6d657472792e70726f746f1a2b676f6f676c65" . + "2f636c6f75642f766973696f6e2f76312f70726f647563745f7365617263" . + "682e70726f746f1a2c676f6f676c652f636c6f75642f766973696f6e2f76" . + "312f746578745f616e6e6f746174696f6e2e70726f746f1a2a676f6f676c" . + "652f636c6f75642f766973696f6e2f76312f7765625f646574656374696f" . + "6e2e70726f746f1a23676f6f676c652f6c6f6e6772756e6e696e672f6f70" . + "65726174696f6e732e70726f746f1a1f676f6f676c652f70726f746f6275" . + "662f74696d657374616d702e70726f746f1a17676f6f676c652f7270632f" . + "7374617475732e70726f746f1a17676f6f676c652f747970652f636f6c6f" . + "722e70726f746f1a18676f6f676c652f747970652f6c61746c6e672e7072" . + "6f746f2287030a074665617475726512320a047479706518012001280e32" . + "242e676f6f676c652e636c6f75642e766973696f6e2e76312e4665617475" . + "72652e5479706512130a0b6d61785f726573756c7473180220012805120d" . + "0a056d6f64656c18032001280922a3020a045479706512140a1054595045" . + "5f554e535045434946494544100012120a0e464143455f44455445435449" . + "4f4e100112160a124c414e444d41524b5f444554454354494f4e10021212" . + "0a0e4c4f474f5f444554454354494f4e100312130a0f4c4142454c5f4445" . + "54454354494f4e100412120a0e544558545f444554454354494f4e100512" . + "1b0a17444f43554d454e545f544558545f444554454354494f4e100b1219" . + "0a15534146455f5345415243485f444554454354494f4e100612140a1049" . + "4d4147455f50524f504552544945531007120e0a0a43524f505f48494e54" . + "53100912110a0d5745425f444554454354494f4e100a12120a0e50524f44" . + "5543545f534541524348100c12170a134f424a4543545f4c4f43414c495a" . + "4154494f4e101322370a0b496d616765536f7572636512150a0d6763735f" . + "696d6167655f75726918012001280912110a09696d6167655f7572691802" . + "20012809224d0a05496d616765120f0a07636f6e74656e7418012001280c" . + "12330a06736f7572636518022001280b32232e676f6f676c652e636c6f75" . + "642e766973696f6e2e76312e496d616765536f7572636522c70d0a0e4661" . + "6365416e6e6f746174696f6e123b0a0d626f756e64696e675f706f6c7918" . + "012001280b32242e676f6f676c652e636c6f75642e766973696f6e2e7631" . + "2e426f756e64696e67506f6c79123e0a1066645f626f756e64696e675f70" . + "6f6c7918022001280b32242e676f6f676c652e636c6f75642e766973696f" . + "6e2e76312e426f756e64696e67506f6c7912420a096c616e646d61726b73" . + "18032003280b322f2e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e46616365416e6e6f746174696f6e2e4c616e646d61726b12120a0a72" . + "6f6c6c5f616e676c6518042001280212110a0970616e5f616e676c651805" . + "2001280212120a0a74696c745f616e676c65180620012802121c0a146465" . + "74656374696f6e5f636f6e666964656e6365180720012802121e0a166c61" . + "6e646d61726b696e675f636f6e666964656e6365180820012802123a0a0e" . + "6a6f795f6c696b656c69686f6f6418092001280e32222e676f6f676c652e" . + "636c6f75642e766973696f6e2e76312e4c696b656c69686f6f64123d0a11" . + "736f72726f775f6c696b656c69686f6f64180a2001280e32222e676f6f67" . + "6c652e636c6f75642e766973696f6e2e76312e4c696b656c69686f6f6412" . + "3c0a10616e6765725f6c696b656c69686f6f64180b2001280e32222e676f" . "6f676c652e636c6f75642e766973696f6e2e76312e4c696b656c69686f6f" . - "6412440a18756e6465725f6578706f7365645f6c696b656c69686f6f6418" . - "0d2001280e32222e676f6f676c652e636c6f75642e766973696f6e2e7631" . - "2e4c696b656c69686f6f64123e0a12626c75727265645f6c696b656c6968" . - "6f6f64180e2001280e32222e676f6f676c652e636c6f75642e766973696f" . - "6e2e76312e4c696b656c69686f6f64123f0a1368656164776561725f6c69" . - "6b656c69686f6f64180f2001280e32222e676f6f676c652e636c6f75642e" . - "766973696f6e2e76312e4c696b656c69686f6f641ab9070a084c616e646d" . - "61726b12420a047479706518032001280e32342e676f6f676c652e636c6f" . - "75642e766973696f6e2e76312e46616365416e6e6f746174696f6e2e4c61" . - "6e646d61726b2e5479706512320a08706f736974696f6e18042001280b32" . - "202e676f6f676c652e636c6f75642e766973696f6e2e76312e506f736974" . - "696f6e22b4060a045479706512140a10554e4b4e4f574e5f4c414e444d41" . - "524b1000120c0a084c4546545f4559451001120d0a0952494748545f4559" . - "45100212180a144c4546545f4f465f4c4546545f45594542524f57100312" . - "190a1552494748545f4f465f4c4546545f45594542524f57100412190a15" . - "4c4546545f4f465f52494748545f45594542524f571005121a0a16524947" . - "48545f4f465f52494748545f45594542524f57100612190a154d4944504f" . - "494e545f4245545745454e5f455945531007120c0a084e4f53455f544950" . - "1008120d0a0955505045525f4c49501009120d0a094c4f5745525f4c4950" . - "100a120e0a0a4d4f5554485f4c454654100b120f0a0b4d4f5554485f5249" . - "474854100c12100a0c4d4f5554485f43454e544552100d12150a114e4f53" . - "455f424f54544f4d5f5249474854100e12140a104e4f53455f424f54544f" . - "4d5f4c454654100f12160a124e4f53455f424f54544f4d5f43454e544552" . - "101012190a154c4546545f4559455f544f505f424f554e44415259101112" . - "190a154c4546545f4559455f52494748545f434f524e45521012121c0a18" . - "4c4546545f4559455f424f54544f4d5f424f554e44415259101312180a14" . - "4c4546545f4559455f4c4546545f434f524e45521014121a0a1652494748" . - "545f4559455f544f505f424f554e444152591015121a0a1652494748545f" . - "4559455f52494748545f434f524e45521016121d0a1952494748545f4559" . - "455f424f54544f4d5f424f554e44415259101712190a1552494748545f45" . - "59455f4c4546545f434f524e45521018121f0a1b4c4546545f4559454252" . - "4f575f55505045525f4d4944504f494e54101912200a1c52494748545f45" . - "594542524f575f55505045525f4d4944504f494e54101a12140a104c4546" . - "545f4541525f54524147494f4e101b12150a1152494748545f4541525f54" . - "524147494f4e101c12120a0e4c4546545f4559455f505550494c101d1213" . - "0a0f52494748545f4559455f505550494c101e12150a11464f5245484541" . - "445f474c4142454c4c41101f12110a0d4348494e5f474e415448494f4e10" . - "2012140a104348494e5f4c4546545f474f4e494f4e102112150a11434849" . - "4e5f52494748545f474f4e494f4e102222340a0c4c6f636174696f6e496e" . - "666f12240a076c61745f6c6e6718012001280b32132e676f6f676c652e74" . - "7970652e4c61744c6e67223d0a0850726f7065727479120c0a046e616d65" . - "180120012809120d0a0576616c756518022001280912140a0c75696e7436" . - "345f76616c756518032001280422a7020a10456e74697479416e6e6f7461" . - "74696f6e120b0a036d6964180120012809120e0a066c6f63616c65180220" . - "01280912130a0b6465736372697074696f6e180320012809120d0a057363" . - "6f726518042001280212120a0a636f6e666964656e636518052001280212" . - "120a0a746f706963616c697479180620012802123b0a0d626f756e64696e" . - "675f706f6c7918072001280b32242e676f6f676c652e636c6f75642e7669" . - "73696f6e2e76312e426f756e64696e67506f6c7912370a096c6f63617469" . - "6f6e7318082003280b32242e676f6f676c652e636c6f75642e766973696f" . - "6e2e76312e4c6f636174696f6e496e666f12340a0a70726f706572746965" . - "7318092003280b32202e676f6f676c652e636c6f75642e766973696f6e2e" . - "76312e50726f70657274792299010a194c6f63616c697a65644f626a6563" . - "74416e6e6f746174696f6e120b0a036d696418012001280912150a0d6c61" . - "6e67756167655f636f6465180220012809120c0a046e616d651803200128" . - "09120d0a0573636f7265180420012802123b0a0d626f756e64696e675f70" . - "6f6c7918052001280b32242e676f6f676c652e636c6f75642e766973696f" . - "6e2e76312e426f756e64696e67506f6c792299020a145361666553656172" . - "6368416e6e6f746174696f6e12310a056164756c7418012001280e32222e" . + "64123f0a1373757270726973655f6c696b656c69686f6f64180c2001280e" . + "32222e676f6f676c652e636c6f75642e766973696f6e2e76312e4c696b65" . + "6c69686f6f6412440a18756e6465725f6578706f7365645f6c696b656c69" . + "686f6f64180d2001280e32222e676f6f676c652e636c6f75642e76697369" . + "6f6e2e76312e4c696b656c69686f6f64123e0a12626c75727265645f6c69" . + "6b656c69686f6f64180e2001280e32222e676f6f676c652e636c6f75642e" . + "766973696f6e2e76312e4c696b656c69686f6f64123f0a13686561647765" . + "61725f6c696b656c69686f6f64180f2001280e32222e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e4c696b656c69686f6f641ab9070a08" . + "4c616e646d61726b12420a047479706518032001280e32342e676f6f676c" . + "652e636c6f75642e766973696f6e2e76312e46616365416e6e6f74617469" . + "6f6e2e4c616e646d61726b2e5479706512320a08706f736974696f6e1804" . + "2001280b32202e676f6f676c652e636c6f75642e766973696f6e2e76312e" . + "506f736974696f6e22b4060a045479706512140a10554e4b4e4f574e5f4c" . + "414e444d41524b1000120c0a084c4546545f4559451001120d0a09524947" . + "48545f455945100212180a144c4546545f4f465f4c4546545f4559454252" . + "4f57100312190a1552494748545f4f465f4c4546545f45594542524f5710" . + "0412190a154c4546545f4f465f52494748545f45594542524f571005121a" . + "0a1652494748545f4f465f52494748545f45594542524f57100612190a15" . + "4d4944504f494e545f4245545745454e5f455945531007120c0a084e4f53" . + "455f5449501008120d0a0955505045525f4c49501009120d0a094c4f5745" . + "525f4c4950100a120e0a0a4d4f5554485f4c454654100b120f0a0b4d4f55" . + "54485f5249474854100c12100a0c4d4f5554485f43454e544552100d1215" . + "0a114e4f53455f424f54544f4d5f5249474854100e12140a104e4f53455f" . + "424f54544f4d5f4c454654100f12160a124e4f53455f424f54544f4d5f43" . + "454e544552101012190a154c4546545f4559455f544f505f424f554e4441" . + "5259101112190a154c4546545f4559455f52494748545f434f524e455210" . + "12121c0a184c4546545f4559455f424f54544f4d5f424f554e4441525910" . + "1312180a144c4546545f4559455f4c4546545f434f524e45521014121a0a" . + "1652494748545f4559455f544f505f424f554e444152591015121a0a1652" . + "494748545f4559455f52494748545f434f524e45521016121d0a19524947" . + "48545f4559455f424f54544f4d5f424f554e44415259101712190a155249" . + "4748545f4559455f4c4546545f434f524e45521018121f0a1b4c4546545f" . + "45594542524f575f55505045525f4d4944504f494e54101912200a1c5249" . + "4748545f45594542524f575f55505045525f4d4944504f494e54101a1214" . + "0a104c4546545f4541525f54524147494f4e101b12150a1152494748545f" . + "4541525f54524147494f4e101c12120a0e4c4546545f4559455f50555049" . + "4c101d12130a0f52494748545f4559455f505550494c101e12150a11464f" . + "5245484541445f474c4142454c4c41101f12110a0d4348494e5f474e4154" . + "48494f4e102012140a104348494e5f4c4546545f474f4e494f4e10211215" . + "0a114348494e5f52494748545f474f4e494f4e102222340a0c4c6f636174" . + "696f6e496e666f12240a076c61745f6c6e6718012001280b32132e676f6f" . + "676c652e747970652e4c61744c6e67223d0a0850726f7065727479120c0a" . + "046e616d65180120012809120d0a0576616c756518022001280912140a0c" . + "75696e7436345f76616c756518032001280422ab020a10456e7469747941" . + "6e6e6f746174696f6e120b0a036d6964180120012809120e0a066c6f6361" . + "6c6518022001280912130a0b6465736372697074696f6e18032001280912" . + "0d0a0573636f726518042001280212160a0a636f6e666964656e63651805" . + "200128024202180112120a0a746f706963616c697479180620012802123b" . + "0a0d626f756e64696e675f706f6c7918072001280b32242e676f6f676c65" . + "2e636c6f75642e766973696f6e2e76312e426f756e64696e67506f6c7912" . + "370a096c6f636174696f6e7318082003280b32242e676f6f676c652e636c" . + "6f75642e766973696f6e2e76312e4c6f636174696f6e496e666f12340a0a" . + "70726f7065727469657318092003280b32202e676f6f676c652e636c6f75" . + "642e766973696f6e2e76312e50726f70657274792299010a194c6f63616c" . + "697a65644f626a656374416e6e6f746174696f6e120b0a036d6964180120" . + "01280912150a0d6c616e67756167655f636f6465180220012809120c0a04" . + "6e616d65180320012809120d0a0573636f7265180420012802123b0a0d62" . + "6f756e64696e675f706f6c7918052001280b32242e676f6f676c652e636c" . + "6f75642e766973696f6e2e76312e426f756e64696e67506f6c792299020a" . + "1453616665536561726368416e6e6f746174696f6e12310a056164756c74" . + "18012001280e32222e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e4c696b656c69686f6f6412310a0573706f6f6618022001280e32222e" . "676f6f676c652e636c6f75642e766973696f6e2e76312e4c696b656c6968" . - "6f6f6412310a0573706f6f6618022001280e32222e676f6f676c652e636c" . - "6f75642e766973696f6e2e76312e4c696b656c69686f6f6412330a076d65" . - "646963616c18032001280e32222e676f6f676c652e636c6f75642e766973" . - "696f6e2e76312e4c696b656c69686f6f6412340a0876696f6c656e636518" . - "042001280e32222e676f6f676c652e636c6f75642e766973696f6e2e7631" . - "2e4c696b656c69686f6f6412300a047261637918092001280e32222e676f" . - "6f676c652e636c6f75642e766973696f6e2e76312e4c696b656c69686f6f" . - "6422610a0b4c61744c6f6e675265637412280a0b6d696e5f6c61745f6c6e" . - "6718012001280b32132e676f6f676c652e747970652e4c61744c6e671228" . - "0a0b6d61785f6c61745f6c6e6718022001280b32132e676f6f676c652e74" . - "7970652e4c61744c6e6722550a09436f6c6f72496e666f12210a05636f6c" . - "6f7218012001280b32122e676f6f676c652e747970652e436f6c6f72120d" . - "0a0573636f726518022001280212160a0e706978656c5f6672616374696f" . - "6e180320012802224d0a18446f6d696e616e74436f6c6f7273416e6e6f74" . - "6174696f6e12310a06636f6c6f727318012003280b32212e676f6f676c65" . - "2e636c6f75642e766973696f6e2e76312e436f6c6f72496e666f225c0a0f" . - "496d61676550726f7065727469657312490a0f646f6d696e616e745f636f" . - "6c6f727318012001280b32302e676f6f676c652e636c6f75642e76697369" . - "6f6e2e76312e446f6d696e616e74436f6c6f7273416e6e6f746174696f6e" . - "22780a0843726f7048696e74123b0a0d626f756e64696e675f706f6c7918" . - "012001280b32242e676f6f676c652e636c6f75642e766973696f6e2e7631" . - "2e426f756e64696e67506f6c7912120a0a636f6e666964656e6365180220" . - "012802121b0a13696d706f7274616e63655f6672616374696f6e18032001" . - "2802224b0a1343726f7048696e7473416e6e6f746174696f6e12340a0a63" . - "726f705f68696e747318012003280b32202e676f6f676c652e636c6f7564" . - "2e766973696f6e2e76312e43726f7048696e7422280a0f43726f7048696e" . - "7473506172616d7312150a0d6173706563745f726174696f731801200328" . - "0222310a12576562446574656374696f6e506172616d73121b0a13696e63" . - "6c7564655f67656f5f726573756c747318022001280822f0010a0c496d61" . - "6765436f6e74657874123a0a0d6c61745f6c6f6e675f7265637418012001" . - "280b32232e676f6f676c652e636c6f75642e766973696f6e2e76312e4c61" . - "744c6f6e675265637412160a0e6c616e67756167655f68696e7473180220" . - "03280912420a1163726f705f68696e74735f706172616d7318042001280b" . - "32272e676f6f676c652e636c6f75642e766973696f6e2e76312e43726f70" . - "48696e7473506172616d7312480a147765625f646574656374696f6e5f70" . - "6172616d7318062001280b322a2e676f6f676c652e636c6f75642e766973" . - "696f6e2e76312e576562446574656374696f6e506172616d7322b4010a14" . - "416e6e6f74617465496d61676552657175657374122c0a05696d61676518" . - "012001280b321d2e676f6f676c652e636c6f75642e766973696f6e2e7631" . - "2e496d61676512310a08666561747572657318022003280b321f2e676f6f" . - "676c652e636c6f75642e766973696f6e2e76312e46656174757265123b0a" . - "0d696d6167655f636f6e7465787418032001280b32242e676f6f676c652e" . - "636c6f75642e766973696f6e2e76312e496d616765436f6e74657874223a" . - "0a16496d616765416e6e6f746174696f6e436f6e74657874120b0a037572" . - "6918012001280912130a0b706167655f6e756d6265721802200128052296" . - "070a15416e6e6f74617465496d616765526573706f6e736512400a106661" . - "63655f616e6e6f746174696f6e7318012003280b32262e676f6f676c652e" . - "636c6f75642e766973696f6e2e76312e46616365416e6e6f746174696f6e" . - "12460a146c616e646d61726b5f616e6e6f746174696f6e7318022003280b" . - "32282e676f6f676c652e636c6f75642e766973696f6e2e76312e456e7469" . - "7479416e6e6f746174696f6e12420a106c6f676f5f616e6e6f746174696f" . - "6e7318032003280b32282e676f6f676c652e636c6f75642e766973696f6e" . - "2e76312e456e74697479416e6e6f746174696f6e12430a116c6162656c5f" . - "616e6e6f746174696f6e7318042003280b32282e676f6f676c652e636c6f" . - "75642e766973696f6e2e76312e456e74697479416e6e6f746174696f6e12" . - "570a1c6c6f63616c697a65645f6f626a6563745f616e6e6f746174696f6e" . - "7318162003280b32312e676f6f676c652e636c6f75642e766973696f6e2e" . - "76312e4c6f63616c697a65644f626a656374416e6e6f746174696f6e1242" . - "0a10746578745f616e6e6f746174696f6e7318052003280b32282e676f6f" . - "676c652e636c6f75642e766973696f6e2e76312e456e74697479416e6e6f" . - "746174696f6e12440a1466756c6c5f746578745f616e6e6f746174696f6e" . - "180c2001280b32262e676f6f676c652e636c6f75642e766973696f6e2e76" . - "312e54657874416e6e6f746174696f6e124c0a16736166655f7365617263" . - "685f616e6e6f746174696f6e18062001280b322c2e676f6f676c652e636c" . - "6f75642e766973696f6e2e76312e53616665536561726368416e6e6f7461" . - "74696f6e124c0a1b696d6167655f70726f706572746965735f616e6e6f74" . - "6174696f6e18082001280b32272e676f6f676c652e636c6f75642e766973" . - "696f6e2e76312e496d61676550726f70657274696573124a0a1563726f70" . - "5f68696e74735f616e6e6f746174696f6e180b2001280b322b2e676f6f67" . - "6c652e636c6f75642e766973696f6e2e76312e43726f7048696e7473416e" . - "6e6f746174696f6e123b0a0d7765625f646574656374696f6e180d200128" . - "0b32242e676f6f676c652e636c6f75642e766973696f6e2e76312e576562" . - "446574656374696f6e12210a056572726f7218092001280b32122e676f6f" . - "676c652e7270632e537461747573123f0a07636f6e746578741815200128" . - "0b322e2e676f6f676c652e636c6f75642e766973696f6e2e76312e496d61" . - "6765416e6e6f746174696f6e436f6e746578742293010a14416e6e6f7461" . - "746546696c65526573706f6e736512390a0c696e7075745f636f6e666967" . - "18012001280b32232e676f6f676c652e636c6f75642e766973696f6e2e76" . - "312e496e707574436f6e66696712400a09726573706f6e73657318022003" . - "280b322d2e676f6f676c652e636c6f75642e766973696f6e2e76312e416e" . - "6e6f74617465496d616765526573706f6e7365225c0a1a4261746368416e" . - "6e6f74617465496d6167657352657175657374123e0a0872657175657374" . - "7318012003280b322c2e676f6f676c652e636c6f75642e766973696f6e2e" . - "76312e416e6e6f74617465496d61676552657175657374225f0a1b426174" . - "6368416e6e6f74617465496d61676573526573706f6e736512400a097265" . - "73706f6e73657318012003280b322d2e676f6f676c652e636c6f75642e76" . - "6973696f6e2e76312e416e6e6f74617465496d616765526573706f6e7365" . - "2282020a184173796e63416e6e6f7461746546696c655265717565737412" . - "390a0c696e7075745f636f6e66696718012001280b32232e676f6f676c65" . - "2e636c6f75642e766973696f6e2e76312e496e707574436f6e6669671231" . - "0a08666561747572657318022003280b321f2e676f6f676c652e636c6f75" . - "642e766973696f6e2e76312e46656174757265123b0a0d696d6167655f63" . - "6f6e7465787418032001280b32242e676f6f676c652e636c6f75642e7669" . - "73696f6e2e76312e496d616765436f6e74657874123b0a0d6f7574707574" . - "5f636f6e66696718042001280b32242e676f6f676c652e636c6f75642e76" . - "6973696f6e2e76312e4f7574707574436f6e66696722580a194173796e63" . - "416e6e6f7461746546696c65526573706f6e7365123b0a0d6f7574707574" . - "5f636f6e66696718012001280b32242e676f6f676c652e636c6f75642e76" . - "6973696f6e2e76312e4f7574707574436f6e66696722640a1e4173796e63" . - "4261746368416e6e6f7461746546696c65735265717565737412420a0872" . - "6571756573747318012003280b32302e676f6f676c652e636c6f75642e76" . - "6973696f6e2e76312e4173796e63416e6e6f7461746546696c6552657175" . - "65737422670a1f4173796e634261746368416e6e6f7461746546696c6573" . - "526573706f6e736512440a09726573706f6e73657318012003280b32312e" . - "676f6f676c652e636c6f75642e766973696f6e2e76312e4173796e63416e" . - "6e6f7461746546696c65526573706f6e736522570a0b496e707574436f6e" . - "66696712350a0a6763735f736f7572636518012001280b32212e676f6f67" . - "6c652e636c6f75642e766973696f6e2e76312e476373536f757263651211" . - "0a096d696d655f7479706518022001280922630a0c4f7574707574436f6e" . - "666967123f0a0f6763735f64657374696e6174696f6e18012001280b3226" . - "2e676f6f676c652e636c6f75642e766973696f6e2e76312e476373446573" . - "74696e6174696f6e12120a0a62617463685f73697a651802200128052218" . - "0a09476373536f75726365120b0a03757269180120012809221d0a0e4763" . - "7344657374696e6174696f6e120b0a037572691801200128092288020a11" . - "4f7065726174696f6e4d65746164617461123e0a05737461746518012001" . - "280e322f2e676f6f676c652e636c6f75642e766973696f6e2e76312e4f70" . - "65726174696f6e4d657461646174612e5374617465122f0a0b6372656174" . - "655f74696d6518052001280b321a2e676f6f676c652e70726f746f627566" . - "2e54696d657374616d70122f0a0b7570646174655f74696d651806200128" . - "0b321a2e676f6f676c652e70726f746f6275662e54696d657374616d7022" . - "510a05537461746512150a1153544154455f554e53504543494649454410" . - "00120b0a07435245415445441001120b0a0752554e4e494e47100212080a" . - "04444f4e451003120d0a0943414e43454c4c454410042a650a0a4c696b65" . - "6c69686f6f64120b0a07554e4b4e4f574e100012110a0d564552595f554e" . - "4c494b454c591001120c0a08554e4c494b454c591002120c0a08504f5353" . - "49424c451003120a0a064c494b454c591004120f0a0b564552595f4c494b" . - "454c59100532cd020a0e496d616765416e6e6f7461746f72129e010a1342" . - "61746368416e6e6f74617465496d6167657312322e676f6f676c652e636c" . - "6f75642e766973696f6e2e76312e4261746368416e6e6f74617465496d61" . - "676573526571756573741a332e676f6f676c652e636c6f75642e76697369" . - "6f6e2e76312e4261746368416e6e6f74617465496d61676573526573706f" . - "6e7365221e82d3e493021822132f76312f696d616765733a616e6e6f7461" . - "74653a012a1299010a174173796e634261746368416e6e6f746174654669" . - "6c657312362e676f6f676c652e636c6f75642e766973696f6e2e76312e41" . - "73796e634261746368416e6e6f7461746546696c6573526571756573741a" . - "1d2e676f6f676c652e6c6f6e6772756e6e696e672e4f7065726174696f6e" . - "222782d3e4930221221c2f76312f66696c65733a6173796e634261746368" . - "416e6e6f746174653a012a427b0a1a636f6d2e676f6f676c652e636c6f75" . - "642e766973696f6e2e76314213496d616765416e6e6f7461746f7250726f" . - "746f50015a3c676f6f676c652e676f6c616e672e6f72672f67656e70726f" . - "746f2f676f6f676c65617069732f636c6f75642f766973696f6e2f76313b" . - "766973696f6ef80101a202044743564e620670726f746f33" + "6f6f6412330a076d65646963616c18032001280e32222e676f6f676c652e" . + "636c6f75642e766973696f6e2e76312e4c696b656c69686f6f6412340a08" . + "76696f6c656e636518042001280e32222e676f6f676c652e636c6f75642e" . + "766973696f6e2e76312e4c696b656c69686f6f6412300a04726163791809" . + "2001280e32222e676f6f676c652e636c6f75642e766973696f6e2e76312e" . + "4c696b656c69686f6f6422610a0b4c61744c6f6e675265637412280a0b6d" . + "696e5f6c61745f6c6e6718012001280b32132e676f6f676c652e74797065" . + "2e4c61744c6e6712280a0b6d61785f6c61745f6c6e6718022001280b3213" . + "2e676f6f676c652e747970652e4c61744c6e6722550a09436f6c6f72496e" . + "666f12210a05636f6c6f7218012001280b32122e676f6f676c652e747970" . + "652e436f6c6f72120d0a0573636f726518022001280212160a0e70697865" . + "6c5f6672616374696f6e180320012802224d0a18446f6d696e616e74436f" . + "6c6f7273416e6e6f746174696f6e12310a06636f6c6f727318012003280b" . + "32212e676f6f676c652e636c6f75642e766973696f6e2e76312e436f6c6f" . + "72496e666f225c0a0f496d61676550726f7065727469657312490a0f646f" . + "6d696e616e745f636f6c6f727318012001280b32302e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e446f6d696e616e74436f6c6f727341" . + "6e6e6f746174696f6e22780a0843726f7048696e74123b0a0d626f756e64" . + "696e675f706f6c7918012001280b32242e676f6f676c652e636c6f75642e" . + "766973696f6e2e76312e426f756e64696e67506f6c7912120a0a636f6e66" . + "6964656e6365180220012802121b0a13696d706f7274616e63655f667261" . + "6374696f6e180320012802224b0a1343726f7048696e7473416e6e6f7461" . + "74696f6e12340a0a63726f705f68696e747318012003280b32202e676f6f" . + "676c652e636c6f75642e766973696f6e2e76312e43726f7048696e742228" . + "0a0f43726f7048696e7473506172616d7312150a0d6173706563745f7261" . + "74696f7318012003280222310a12576562446574656374696f6e50617261" . + "6d73121b0a13696e636c7564655f67656f5f726573756c74731802200128" . + "0822bc020a0c496d616765436f6e74657874123a0a0d6c61745f6c6f6e67" . + "5f7265637418012001280b32232e676f6f676c652e636c6f75642e766973" . + "696f6e2e76312e4c61744c6f6e675265637412160a0e6c616e6775616765" . + "5f68696e747318022003280912420a1163726f705f68696e74735f706172" . + "616d7318042001280b32272e676f6f676c652e636c6f75642e766973696f" . + "6e2e76312e43726f7048696e7473506172616d73124a0a1570726f647563" . + "745f7365617263685f706172616d7318052001280b322b2e676f6f676c65" . + "2e636c6f75642e766973696f6e2e76312e50726f64756374536561726368" . + "506172616d7312480a147765625f646574656374696f6e5f706172616d73" . + "18062001280b322a2e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e576562446574656374696f6e506172616d7322b4010a14416e6e6f74" . + "617465496d61676552657175657374122c0a05696d61676518012001280b" . + "321d2e676f6f676c652e636c6f75642e766973696f6e2e76312e496d6167" . + "6512310a08666561747572657318022003280b321f2e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e46656174757265123b0a0d696d6167" . + "655f636f6e7465787418032001280b32242e676f6f676c652e636c6f7564" . + "2e766973696f6e2e76312e496d616765436f6e74657874223a0a16496d61" . + "6765416e6e6f746174696f6e436f6e74657874120b0a0375726918012001" . + "280912130a0b706167655f6e756d62657218022001280522e4070a15416e" . + "6e6f74617465496d616765526573706f6e736512400a10666163655f616e" . + "6e6f746174696f6e7318012003280b32262e676f6f676c652e636c6f7564" . + "2e766973696f6e2e76312e46616365416e6e6f746174696f6e12460a146c" . + "616e646d61726b5f616e6e6f746174696f6e7318022003280b32282e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e456e74697479416e6e" . + "6f746174696f6e12420a106c6f676f5f616e6e6f746174696f6e73180320" . + "03280b32282e676f6f676c652e636c6f75642e766973696f6e2e76312e45" . + "6e74697479416e6e6f746174696f6e12430a116c6162656c5f616e6e6f74" . + "6174696f6e7318042003280b32282e676f6f676c652e636c6f75642e7669" . + "73696f6e2e76312e456e74697479416e6e6f746174696f6e12570a1c6c6f" . + "63616c697a65645f6f626a6563745f616e6e6f746174696f6e7318162003" . + "280b32312e676f6f676c652e636c6f75642e766973696f6e2e76312e4c6f" . + "63616c697a65644f626a656374416e6e6f746174696f6e12420a10746578" . + "745f616e6e6f746174696f6e7318052003280b32282e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e456e74697479416e6e6f746174696f" . + "6e12440a1466756c6c5f746578745f616e6e6f746174696f6e180c200128" . + "0b32262e676f6f676c652e636c6f75642e766973696f6e2e76312e546578" . + "74416e6e6f746174696f6e124c0a16736166655f7365617263685f616e6e" . + "6f746174696f6e18062001280b322c2e676f6f676c652e636c6f75642e76" . + "6973696f6e2e76312e53616665536561726368416e6e6f746174696f6e12" . + "4c0a1b696d6167655f70726f706572746965735f616e6e6f746174696f6e" . + "18082001280b32272e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e496d61676550726f70657274696573124a0a1563726f705f68696e74" . + "735f616e6e6f746174696f6e180b2001280b322b2e676f6f676c652e636c" . + "6f75642e766973696f6e2e76312e43726f7048696e7473416e6e6f746174" . + "696f6e123b0a0d7765625f646574656374696f6e180d2001280b32242e67" . + "6f6f676c652e636c6f75642e766973696f6e2e76312e5765624465746563" . + "74696f6e124c0a1670726f647563745f7365617263685f726573756c7473" . + "180e2001280b322c2e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e50726f64756374536561726368526573756c747312210a056572726f" . + "7218092001280b32122e676f6f676c652e7270632e537461747573123f0a" . + "07636f6e7465787418152001280b322e2e676f6f676c652e636c6f75642e" . + "766973696f6e2e76312e496d616765416e6e6f746174696f6e436f6e7465" . + "78742293010a14416e6e6f7461746546696c65526573706f6e736512390a" . + "0c696e7075745f636f6e66696718012001280b32232e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e496e707574436f6e66696712400a09" . + "726573706f6e73657318022003280b322d2e676f6f676c652e636c6f7564" . + "2e766973696f6e2e76312e416e6e6f74617465496d616765526573706f6e" . + "7365225c0a1a4261746368416e6e6f74617465496d616765735265717565" . + "7374123e0a08726571756573747318012003280b322c2e676f6f676c652e" . + "636c6f75642e766973696f6e2e76312e416e6e6f74617465496d61676552" . + "657175657374225f0a1b4261746368416e6e6f74617465496d6167657352" . + "6573706f6e736512400a09726573706f6e73657318012003280b322d2e67" . + "6f6f676c652e636c6f75642e766973696f6e2e76312e416e6e6f74617465" . + "496d616765526573706f6e73652282020a184173796e63416e6e6f746174" . + "6546696c655265717565737412390a0c696e7075745f636f6e6669671801" . + "2001280b32232e676f6f676c652e636c6f75642e766973696f6e2e76312e" . + "496e707574436f6e66696712310a08666561747572657318022003280b32" . + "1f2e676f6f676c652e636c6f75642e766973696f6e2e76312e4665617475" . + "7265123b0a0d696d6167655f636f6e7465787418032001280b32242e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e496d616765436f6e74" . + "657874123b0a0d6f75747075745f636f6e66696718042001280b32242e67" . + "6f6f676c652e636c6f75642e766973696f6e2e76312e4f7574707574436f" . + "6e66696722580a194173796e63416e6e6f7461746546696c65526573706f" . + "6e7365123b0a0d6f75747075745f636f6e66696718012001280b32242e67" . + "6f6f676c652e636c6f75642e766973696f6e2e76312e4f7574707574436f" . + "6e66696722640a1e4173796e634261746368416e6e6f7461746546696c65" . + "735265717565737412420a08726571756573747318012003280b32302e67" . + "6f6f676c652e636c6f75642e766973696f6e2e76312e4173796e63416e6e" . + "6f7461746546696c655265717565737422670a1f4173796e634261746368" . + "416e6e6f7461746546696c6573526573706f6e736512440a09726573706f" . + "6e73657318012003280b32312e676f6f676c652e636c6f75642e76697369" . + "6f6e2e76312e4173796e63416e6e6f7461746546696c65526573706f6e73" . + "6522570a0b496e707574436f6e66696712350a0a6763735f736f75726365" . + "18012001280b32212e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e476373536f7572636512110a096d696d655f74797065180220012809" . + "22630a0c4f7574707574436f6e666967123f0a0f6763735f64657374696e" . + "6174696f6e18012001280b32262e676f6f676c652e636c6f75642e766973" . + "696f6e2e76312e47637344657374696e6174696f6e12120a0a6261746368" . + "5f73697a6518022001280522180a09476373536f75726365120b0a037572" . + "69180120012809221d0a0e47637344657374696e6174696f6e120b0a0375" . + "72691801200128092288020a114f7065726174696f6e4d65746164617461" . + "123e0a05737461746518012001280e322f2e676f6f676c652e636c6f7564" . + "2e766973696f6e2e76312e4f7065726174696f6e4d657461646174612e53" . + "74617465122f0a0b6372656174655f74696d6518052001280b321a2e676f" . + "6f676c652e70726f746f6275662e54696d657374616d70122f0a0b757064" . + "6174655f74696d6518062001280b321a2e676f6f676c652e70726f746f62" . + "75662e54696d657374616d7022510a05537461746512150a115354415445" . + "5f554e5350454349464945441000120b0a07435245415445441001120b0a" . + "0752554e4e494e47100212080a04444f4e451003120d0a0943414e43454c" . + "4c454410042a650a0a4c696b656c69686f6f64120b0a07554e4b4e4f574e" . + "100012110a0d564552595f554e4c494b454c591001120c0a08554e4c494b" . + "454c591002120c0a08504f535349424c451003120a0a064c494b454c5910" . + "04120f0a0b564552595f4c494b454c59100532cd020a0e496d616765416e" . + "6e6f7461746f72129e010a134261746368416e6e6f74617465496d616765" . + "7312322e676f6f676c652e636c6f75642e766973696f6e2e76312e426174" . + "6368416e6e6f74617465496d61676573526571756573741a332e676f6f67" . + "6c652e636c6f75642e766973696f6e2e76312e4261746368416e6e6f7461" . + "7465496d61676573526573706f6e7365221e82d3e493021822132f76312f" . + "696d616765733a616e6e6f746174653a012a1299010a174173796e634261" . + "746368416e6e6f7461746546696c657312362e676f6f676c652e636c6f75" . + "642e766973696f6e2e76312e4173796e634261746368416e6e6f74617465" . + "46696c6573526571756573741a1d2e676f6f676c652e6c6f6e6772756e6e" . + "696e672e4f7065726174696f6e222782d3e4930221221c2f76312f66696c" . + "65733a6173796e634261746368416e6e6f746174653a012a427b0a1a636f" . + "6d2e676f6f676c652e636c6f75642e766973696f6e2e76314213496d6167" . + "65416e6e6f7461746f7250726f746f50015a3c676f6f676c652e676f6c61" . + "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f636c6f" . + "75642f766973696f6e2f76313b766973696f6ef80101a202044743564e62" . + "0670726f746f33" )); static::$is_initialized = true; diff --git a/Vision/metadata/V1/ProductSearch.php b/Vision/metadata/V1/ProductSearch.php new file mode 100644 index 000000000000..d4fe82f8c1af --- /dev/null +++ b/Vision/metadata/V1/ProductSearch.php @@ -0,0 +1,59 @@ +internalAddGeneratedFile(hex2bin( + "0ab7070a2b676f6f676c652f636c6f75642f766973696f6e2f76312f7072" . + "6f647563745f7365617263682e70726f746f1216676f6f676c652e636c6f" . + "75642e766973696f6e2e76311a25676f6f676c652f636c6f75642f766973" . + "696f6e2f76312f67656f6d657472792e70726f746f1a33676f6f676c652f" . + "636c6f75642f766973696f6e2f76312f70726f647563745f736561726368" . + "5f736572766963652e70726f746f1a1f676f6f676c652f70726f746f6275" . + "662f74696d657374616d702e70726f746f2293010a1350726f6475637453" . + "6561726368506172616d73123b0a0d626f756e64696e675f706f6c791809" . + "2001280b32242e676f6f676c652e636c6f75642e766973696f6e2e76312e" . + "426f756e64696e67506f6c7912130a0b70726f647563745f736574180620" . + "012809121a0a1270726f647563745f63617465676f726965731807200328" . + "09120e0a0666696c74657218082001280922d8030a1450726f6475637453" . + "6561726368526573756c7473122e0a0a696e6465785f74696d6518022001" . + "280b321a2e676f6f676c652e70726f746f6275662e54696d657374616d70" . + "12440a07726573756c747318052003280b32332e676f6f676c652e636c6f" . + "75642e766973696f6e2e76312e50726f6475637453656172636852657375" . + "6c74732e526573756c74125b0a1770726f647563745f67726f757065645f" . + "726573756c747318062003280b323a2e676f6f676c652e636c6f75642e76" . + "6973696f6e2e76312e50726f64756374536561726368526573756c74732e" . + "47726f75706564526573756c741a580a06526573756c7412300a0770726f" . + "6475637418012001280b321f2e676f6f676c652e636c6f75642e76697369" . + "6f6e2e76312e50726f64756374120d0a0573636f7265180220012802120d" . + "0a05696d6167651803200128091a92010a0d47726f75706564526573756c" . + "74123b0a0d626f756e64696e675f706f6c7918012001280b32242e676f6f" . + "676c652e636c6f75642e766973696f6e2e76312e426f756e64696e67506f" . + "6c7912440a07726573756c747318022003280b32332e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e50726f647563745365617263685265" . + "73756c74732e526573756c74427a0a1a636f6d2e676f6f676c652e636c6f" . + "75642e766973696f6e2e7631421250726f6475637453656172636850726f" . + "746f50015a3c676f6f676c652e676f6c616e672e6f72672f67656e70726f" . + "746f2f676f6f676c65617069732f636c6f75642f766973696f6e2f76313b" . + "766973696f6ef80101a202044743564e620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/Vision/metadata/V1/ProductSearchService.php b/Vision/metadata/V1/ProductSearchService.php new file mode 100644 index 000000000000..c1e9f718993c --- /dev/null +++ b/Vision/metadata/V1/ProductSearchService.php @@ -0,0 +1,248 @@ +internalAddGeneratedFile(hex2bin( + "0af8320a33676f6f676c652f636c6f75642f766973696f6e2f76312f7072" . + "6f647563745f7365617263685f736572766963652e70726f746f1216676f" . + "6f676c652e636c6f75642e766973696f6e2e76311a25676f6f676c652f63" . + "6c6f75642f766973696f6e2f76312f67656f6d657472792e70726f746f1a" . + "23676f6f676c652f6c6f6e6772756e6e696e672f6f7065726174696f6e73" . + "2e70726f746f1a1b676f6f676c652f70726f746f6275662f656d7074792e" . + "70726f746f1a20676f6f676c652f70726f746f6275662f6669656c645f6d" . + "61736b2e70726f746f1a1f676f6f676c652f70726f746f6275662f74696d" . + "657374616d702e70726f746f1a17676f6f676c652f7270632f7374617475" . + "732e70726f746f22c6010a0750726f64756374120c0a046e616d65180120" . + "01280912140a0c646973706c61795f6e616d6518022001280912130a0b64" . + "65736372697074696f6e18032001280912180a1070726f647563745f6361" . + "7465676f727918042001280912400a0e70726f647563745f6c6162656c73" . + "18052003280b32282e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e50726f647563742e4b657956616c75651a260a084b657956616c7565" . + "120b0a036b6579180120012809120d0a0576616c75651802200128092289" . + "010a0a50726f64756374536574120c0a046e616d6518012001280912140a" . + "0c646973706c61795f6e616d65180220012809122e0a0a696e6465785f74" . + "696d6518032001280b321a2e676f6f676c652e70726f746f6275662e5469" . + "6d657374616d7012270a0b696e6465785f6572726f7218042001280b3212" . + "2e676f6f676c652e7270632e53746174757322690a0e5265666572656e63" . + "65496d616765120c0a046e616d65180120012809120b0a03757269180220" . + "012809123c0a0e626f756e64696e675f706f6c797318032003280b32242e" . + "676f6f676c652e636c6f75642e766973696f6e2e76312e426f756e64696e" . + "67506f6c79226c0a1443726561746550726f647563745265717565737412" . + "0e0a06706172656e7418012001280912300a0770726f6475637418022001" . + "280b321f2e676f6f676c652e636c6f75642e766973696f6e2e76312e5072" . + "6f6475637412120a0a70726f647563745f6964180320012809224c0a134c" . + "69737450726f647563747352657175657374120e0a06706172656e741801" . + "2001280912110a09706167655f73697a6518022001280512120a0a706167" . + "655f746f6b656e18032001280922620a144c69737450726f647563747352" . + "6573706f6e736512310a0870726f647563747318012003280b321f2e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e50726f647563741217" . + "0a0f6e6578745f706167655f746f6b656e18022001280922210a11476574" . + "50726f6475637452657175657374120c0a046e616d651801200128092279" . + "0a1455706461746550726f647563745265717565737412300a0770726f64" . + "75637418012001280b321f2e676f6f676c652e636c6f75642e766973696f" . + "6e2e76312e50726f64756374122f0a0b7570646174655f6d61736b180220" . + "01280b321a2e676f6f676c652e70726f746f6275662e4669656c644d6173" . + "6b22240a1444656c65746550726f6475637452657175657374120c0a046e" . + "616d65180120012809227a0a1743726561746550726f6475637453657452" . + "657175657374120e0a06706172656e7418012001280912370a0b70726f64" . + "7563745f73657418022001280b32222e676f6f676c652e636c6f75642e76" . + "6973696f6e2e76312e50726f6475637453657412160a0e70726f64756374" . + "5f7365745f6964180320012809224f0a164c69737450726f647563745365" . + "747352657175657374120e0a06706172656e7418012001280912110a0970" . + "6167655f73697a6518022001280512120a0a706167655f746f6b656e1803" . + "20012809226c0a174c69737450726f6475637453657473526573706f6e73" . + "6512380a0c70726f647563745f7365747318012003280b32222e676f6f67" . + "6c652e636c6f75642e766973696f6e2e76312e50726f6475637453657412" . + "170a0f6e6578745f706167655f746f6b656e18022001280922240a144765" . + "7450726f6475637453657452657175657374120c0a046e616d6518012001" . + "28092283010a1755706461746550726f6475637453657452657175657374" . + "12370a0b70726f647563745f73657418012001280b32222e676f6f676c65" . + "2e636c6f75642e766973696f6e2e76312e50726f64756374536574122f0a" . + "0b7570646174655f6d61736b18022001280b321a2e676f6f676c652e7072" . + "6f746f6275662e4669656c644d61736b22270a1744656c65746550726f64" . + "75637453657452657175657374120c0a046e616d65180120012809228a01" . + "0a1b4372656174655265666572656e6365496d6167655265717565737412" . + "0e0a06706172656e74180120012809123f0a0f7265666572656e63655f69" . + "6d61676518022001280b32262e676f6f676c652e636c6f75642e76697369" . + "6f6e2e76312e5265666572656e6365496d616765121a0a12726566657265" . + "6e63655f696d6167655f696418032001280922530a1a4c69737452656665" . + "72656e6365496d6167657352657175657374120e0a06706172656e741801" . + "2001280912110a09706167655f73697a6518022001280512120a0a706167" . + "655f746f6b656e180320012809228b010a1b4c6973745265666572656e63" . + "65496d61676573526573706f6e736512400a107265666572656e63655f69" . + "6d6167657318012003280b32262e676f6f676c652e636c6f75642e766973" . + "696f6e2e76312e5265666572656e6365496d61676512110a09706167655f" . + "73697a6518022001280512170a0f6e6578745f706167655f746f6b656e18" . + "032001280922280a184765745265666572656e6365496d61676552657175" . + "657374120c0a046e616d65180120012809222b0a1b44656c657465526566" . + "6572656e6365496d61676552657175657374120c0a046e616d6518012001" . + "2809223e0a1d41646450726f64756374546f50726f647563745365745265" . + "7175657374120c0a046e616d65180120012809120f0a0770726f64756374" . + "18022001280922430a2252656d6f766550726f6475637446726f6d50726f" . + "6475637453657452657175657374120c0a046e616d65180120012809120f" . + "0a0770726f6475637418022001280922560a1f4c69737450726f64756374" . + "73496e50726f6475637453657452657175657374120c0a046e616d651801" . + "2001280912110a09706167655f73697a6518022001280512120a0a706167" . + "655f746f6b656e180320012809226e0a204c69737450726f647563747349" . + "6e50726f64756374536574526573706f6e736512310a0870726f64756374" . + "7318012003280b321f2e676f6f676c652e636c6f75642e766973696f6e2e" . + "76312e50726f6475637412170a0f6e6578745f706167655f746f6b656e18" . + "022001280922320a1a496d706f727450726f647563745365747347637353" . + "6f7572636512140a0c6373765f66696c655f75726918012001280922720a" . + "1c496d706f727450726f6475637453657473496e707574436f6e66696712" . + "480a0a6763735f736f7572636518012001280b32322e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e496d706f727450726f647563745365" . + "7473476373536f75726365480042080a06736f7572636522760a18496d70" . + "6f727450726f647563745365747352657175657374120e0a06706172656e" . + "74180120012809124a0a0c696e7075745f636f6e66696718022001280b32" . + "342e676f6f676c652e636c6f75642e766973696f6e2e76312e496d706f72" . + "7450726f6475637453657473496e707574436f6e6669672283010a19496d" . + "706f727450726f6475637453657473526573706f6e736512400a10726566" . + "6572656e63655f696d6167657318012003280b32262e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e5265666572656e6365496d61676512" . + "240a08737461747573657318022003280b32122e676f6f676c652e727063" . + "2e5374617475732297020a1642617463684f7065726174696f6e4d657461" . + "6461746112430a05737461746518012001280e32342e676f6f676c652e63" . + "6c6f75642e766973696f6e2e76312e42617463684f7065726174696f6e4d" . + "657461646174612e5374617465122f0a0b7375626d69745f74696d651802" . + "2001280b321a2e676f6f676c652e70726f746f6275662e54696d65737461" . + "6d70122c0a08656e645f74696d6518032001280b321a2e676f6f676c652e" . + "70726f746f6275662e54696d657374616d7022590a05537461746512150a" . + "1153544154455f554e5350454349464945441000120e0a0a50524f434553" . + "53494e471001120e0a0a5355434345535346554c1002120a0a064641494c" . + "45441003120d0a0943414e43454c4c4544100432cf180a0d50726f647563" . + "7453656172636812ad010a1043726561746550726f64756374536574122f" . + "2e676f6f676c652e636c6f75642e766973696f6e2e76312e437265617465" . + "50726f64756374536574526571756573741a222e676f6f676c652e636c6f" . + "75642e766973696f6e2e76312e50726f64756374536574224482d3e49302" . + "3e222f2f76312f7b706172656e743d70726f6a656374732f2a2f6c6f6361" . + "74696f6e732f2a7d2f70726f64756374536574733a0b70726f647563745f" . + "73657412ab010a0f4c69737450726f6475637453657473122e2e676f6f67" . + "6c652e636c6f75642e766973696f6e2e76312e4c69737450726f64756374" . + "53657473526571756573741a2f2e676f6f676c652e636c6f75642e766973" . + "696f6e2e76312e4c69737450726f6475637453657473526573706f6e7365" . + "223782d3e4930231122f2f76312f7b706172656e743d70726f6a65637473" . + "2f2a2f6c6f636174696f6e732f2a7d2f70726f6475637453657473129a01" . + "0a0d47657450726f64756374536574122c2e676f6f676c652e636c6f7564" . + "2e766973696f6e2e76312e47657450726f64756374536574526571756573" . + "741a222e676f6f676c652e636c6f75642e766973696f6e2e76312e50726f" . + "64756374536574223782d3e4930231122f2f76312f7b6e616d653d70726f" . + "6a656374732f2a2f6c6f636174696f6e732f2a2f70726f64756374536574" . + "732f2a7d12b9010a1055706461746550726f64756374536574122f2e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e55706461746550726f" . + "64756374536574526571756573741a222e676f6f676c652e636c6f75642e" . + "766973696f6e2e76312e50726f64756374536574225082d3e493024a323b" . + "2f76312f7b70726f647563745f7365742e6e616d653d70726f6a65637473" . + "2f2a2f6c6f636174696f6e732f2a2f70726f64756374536574732f2a7d3a" . + "0b70726f647563745f7365741294010a1044656c65746550726f64756374" . + "536574122f2e676f6f676c652e636c6f75642e766973696f6e2e76312e44" . + "656c65746550726f64756374536574526571756573741a162e676f6f676c" . + "652e70726f746f6275662e456d707479223782d3e49302312a2f2f76312f" . + "7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f70" . + "726f64756374536574732f2a7d129d010a0d43726561746550726f647563" . + "74122c2e676f6f676c652e636c6f75642e766973696f6e2e76312e437265" . + "61746550726f64756374526571756573741a1f2e676f6f676c652e636c6f" . + "75642e766973696f6e2e76312e50726f64756374223d82d3e4930237222c" . + "2f76312f7b706172656e743d70726f6a656374732f2a2f6c6f636174696f" . + "6e732f2a7d2f70726f64756374733a0770726f64756374129f010a0c4c69" . + "737450726f6475637473122b2e676f6f676c652e636c6f75642e76697369" . + "6f6e2e76312e4c69737450726f6475637473526571756573741a2c2e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e4c69737450726f6475" . + "637473526573706f6e7365223482d3e493022e122c2f76312f7b70617265" . + "6e743d70726f6a656374732f2a2f6c6f636174696f6e732f2a7d2f70726f" . + "6475637473128e010a0a47657450726f6475637412292e676f6f676c652e" . + "636c6f75642e766973696f6e2e76312e47657450726f6475637452657175" . + "6573741a1f2e676f6f676c652e636c6f75642e766973696f6e2e76312e50" . + "726f64756374223482d3e493022e122c2f76312f7b6e616d653d70726f6a" . + "656374732f2a2f6c6f636174696f6e732f2a2f70726f64756374732f2a7d" . + "12a5010a0d55706461746550726f64756374122c2e676f6f676c652e636c" . + "6f75642e766973696f6e2e76312e55706461746550726f64756374526571" . + "756573741a1f2e676f6f676c652e636c6f75642e766973696f6e2e76312e" . + "50726f64756374224582d3e493023f32342f76312f7b70726f647563742e" . + "6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f7072" . + "6f64756374732f2a7d3a0770726f64756374128b010a0d44656c65746550" . + "726f64756374122c2e676f6f676c652e636c6f75642e766973696f6e2e76" . + "312e44656c65746550726f64756374526571756573741a162e676f6f676c" . + "652e70726f746f6275662e456d707479223482d3e493022e2a2c2f76312f" . + "7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f70" . + "726f64756374732f2a7d12cc010a144372656174655265666572656e6365" . + "496d61676512332e676f6f676c652e636c6f75642e766973696f6e2e7631" . + "2e4372656174655265666572656e6365496d616765526571756573741a26" . + "2e676f6f676c652e636c6f75642e766973696f6e2e76312e526566657265" . + "6e6365496d616765225782d3e4930251223e2f76312f7b706172656e743d" . + "70726f6a656374732f2a2f6c6f636174696f6e732f2a2f70726f64756374" . + "732f2a7d2f7265666572656e6365496d616765733a0f7265666572656e63" . + "655f696d61676512ab010a1444656c6574655265666572656e6365496d61" . + "676512332e676f6f676c652e636c6f75642e766973696f6e2e76312e4465" . + "6c6574655265666572656e6365496d616765526571756573741a162e676f" . + "6f676c652e70726f746f6275662e456d707479224682d3e49302402a3e2f" . + "76312f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f" . + "2a2f70726f64756374732f2a2f7265666572656e6365496d616765732f2a" . + "7d12c6010a134c6973745265666572656e6365496d6167657312322e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e4c6973745265666572" . + "656e6365496d61676573526571756573741a332e676f6f676c652e636c6f" . + "75642e766973696f6e2e76312e4c6973745265666572656e6365496d6167" . + "6573526573706f6e7365224682d3e4930240123e2f76312f7b706172656e" . + "743d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f70726f6475" . + "6374732f2a7d2f7265666572656e6365496d6167657312b5010a11476574" . + "5265666572656e6365496d61676512302e676f6f676c652e636c6f75642e" . + "766973696f6e2e76312e4765745265666572656e6365496d616765526571" . + "756573741a262e676f6f676c652e636c6f75642e766973696f6e2e76312e" . + "5265666572656e6365496d616765224682d3e4930240123e2f76312f7b6e" . + "616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f70726f" . + "64756374732f2a2f7265666572656e6365496d616765732f2a7d12ae010a" . + "1641646450726f64756374546f50726f6475637453657412352e676f6f67" . + "6c652e636c6f75642e766973696f6e2e76312e41646450726f6475637454" . + "6f50726f64756374536574526571756573741a162e676f6f676c652e7072" . + "6f746f6275662e456d707479224582d3e493023f223a2f76312f7b6e616d" . + "653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f70726f6475" . + "6374536574732f2a7d3a61646450726f647563743a012a12bb010a1b5265" . + "6d6f766550726f6475637446726f6d50726f64756374536574123a2e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e52656d6f766550726f" . + "6475637446726f6d50726f64756374536574526571756573741a162e676f" . + "6f676c652e70726f746f6275662e456d707479224882d3e4930242223d2f" . + "76312f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f" . + "2a2f70726f64756374536574732f2a7d3a72656d6f766550726f64756374" . + "3a012a12cf010a184c69737450726f6475637473496e50726f6475637453" . + "657412372e676f6f676c652e636c6f75642e766973696f6e2e76312e4c69" . + "737450726f6475637473496e50726f64756374536574526571756573741a" . + "382e676f6f676c652e636c6f75642e766973696f6e2e76312e4c69737450" . + "726f6475637473496e50726f64756374536574526573706f6e7365224082" . + "d3e493023a12382f76312f7b6e616d653d70726f6a656374732f2a2f6c6f" . + "636174696f6e732f2a2f70726f64756374536574732f2a7d2f70726f6475" . + "63747312a7010a11496d706f727450726f647563745365747312302e676f" . + "6f676c652e636c6f75642e766973696f6e2e76312e496d706f727450726f" . + "6475637453657473526571756573741a1d2e676f6f676c652e6c6f6e6772" . + "756e6e696e672e4f7065726174696f6e224182d3e493023b22362f76312f" . + "7b706172656e743d70726f6a656374732f2a2f6c6f636174696f6e732f2a" . + "7d2f70726f64756374536574733a696d706f72743a012a4281010a1a636f" . + "6d2e676f6f676c652e636c6f75642e766973696f6e2e7631421950726f64" . + "7563745365617263685365727669636550726f746f50015a3c676f6f676c" . + "652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c656170" . + "69732f636c6f75642f766973696f6e2f76313b766973696f6ef80101a202" . + "044743564e620670726f746f33" + )); + + static::$is_initialized = true; + } +} + diff --git a/Vision/src/V1/AddProductToProductSetRequest.php b/Vision/src/V1/AddProductToProductSetRequest.php new file mode 100644 index 000000000000..656dbbe14bb1 --- /dev/null +++ b/Vision/src/V1/AddProductToProductSetRequest.php @@ -0,0 +1,117 @@ +google.cloud.vision.v1.AddProductToProductSetRequest + */ +class AddProductToProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2; + */ + private $product = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type string $product + * The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2; + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * The resource name for the Product to be added to this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2; + * @param string $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkString($var, True); + $this->product = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/AnnotateImageResponse.php b/Vision/src/V1/AnnotateImageResponse.php index 916a7dabeb66..6466db5c33e5 100644 --- a/Vision/src/V1/AnnotateImageResponse.php +++ b/Vision/src/V1/AnnotateImageResponse.php @@ -85,6 +85,12 @@ class AnnotateImageResponse extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.vision.v1.WebDetection web_detection = 13; */ private $web_detection = null; + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + */ + private $product_search_results = null; /** * If set, represents the error message for the operation. * Note that filled-in image annotations are guaranteed to be @@ -133,6 +139,8 @@ class AnnotateImageResponse extends \Google\Protobuf\Internal\Message * If present, crop hints have completed successfully. * @type \Google\Cloud\Vision\V1\WebDetection $web_detection * If present, web detection has completed successfully. + * @type \Google\Cloud\Vision\V1\ProductSearchResults $product_search_results + * If present, product search has completed successfully. * @type \Google\Rpc\Status $error * If set, represents the error message for the operation. * Note that filled-in image annotations are guaranteed to be @@ -441,6 +449,32 @@ public function setWebDetection($var) return $this; } + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + * @return \Google\Cloud\Vision\V1\ProductSearchResults + */ + public function getProductSearchResults() + { + return $this->product_search_results; + } + + /** + * If present, product search has completed successfully. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchResults product_search_results = 14; + * @param \Google\Cloud\Vision\V1\ProductSearchResults $var + * @return $this + */ + public function setProductSearchResults($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchResults::class); + $this->product_search_results = $var; + + return $this; + } + /** * If set, represents the error message for the operation. * Note that filled-in image annotations are guaranteed to be diff --git a/Vision/src/V1/BatchOperationMetadata.php b/Vision/src/V1/BatchOperationMetadata.php new file mode 100644 index 000000000000..2d67a1a919fb --- /dev/null +++ b/Vision/src/V1/BatchOperationMetadata.php @@ -0,0 +1,141 @@ +google.cloud.vision.v1.BatchOperationMetadata + */ +class BatchOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + */ + private $state = 0; + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + */ + private $submit_time = null; + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + private $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The current state of the batch operation. + * @type \Google\Protobuf\Timestamp $submit_time + * The time when the batch request was submitted to the server. + * @type \Google\Protobuf\Timestamp $end_time + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the batch operation. + * + * Generated from protobuf field .google.cloud.vision.v1.BatchOperationMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Vision\V1\BatchOperationMetadata_State::class); + $this->state = $var; + + return $this; + } + + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getSubmitTime() + { + return $this->submit_time; + } + + /** + * The time when the batch request was submitted to the server. + * + * Generated from protobuf field .google.protobuf.Timestamp submit_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setSubmitTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->submit_time = $var; + + return $this; + } + + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp + */ + public function getEndTime() + { + return $this->end_time; + } + + /** + * The time when the batch request is finished and + * [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/BatchOperationMetadata/State.php b/Vision/src/V1/BatchOperationMetadata/State.php new file mode 100644 index 000000000000..bd4ece108431 --- /dev/null +++ b/Vision/src/V1/BatchOperationMetadata/State.php @@ -0,0 +1,51 @@ +google.cloud.vision.v1.BatchOperationMetadata.State + */ +class State +{ + /** + * Invalid. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request is actively being processed. + * + * Generated from protobuf enum PROCESSING = 1; + */ + const PROCESSING = 1; + /** + * The request is done and at least one item has been successfully + * processed. + * + * Generated from protobuf enum SUCCESSFUL = 2; + */ + const SUCCESSFUL = 2; + /** + * The request is done and no item has been successfully processed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The request is done after the longrunning.Operations.CancelOperation has + * been called by the user. Any records that were processed before the + * cancel command are output as specified in the request. + * + * Generated from protobuf enum CANCELLED = 4; + */ + const CANCELLED = 4; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Vision\V1\BatchOperationMetadata_State::class); + diff --git a/Vision/src/V1/BatchOperationMetadata_State.php b/Vision/src/V1/BatchOperationMetadata_State.php new file mode 100644 index 000000000000..39f464990c21 --- /dev/null +++ b/Vision/src/V1/BatchOperationMetadata_State.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.CreateProductRequest + */ +class CreateProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2; + */ + private $product = null; + /** + * 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 `/`. + * + * Generated from protobuf field string product_id = 3; + */ + private $product_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\Product $product + * The product to create. + * @type string $product_id + * 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 `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project in which the Product should be created. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2; + * @return \Google\Cloud\Vision\V1\Product + */ + public function getProduct() + { + return $this->product; + } + + /** + * The product to create. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 2; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * 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 `/`. + * + * Generated from protobuf field string product_id = 3; + * @return string + */ + public function getProductId() + { + return $this->product_id; + } + + /** + * 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 `/`. + * + * Generated from protobuf field string product_id = 3; + * @param string $var + * @return $this + */ + public function setProductId($var) + { + GPBUtil::checkString($var, True); + $this->product_id = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/CreateProductSetRequest.php b/Vision/src/V1/CreateProductSetRequest.php new file mode 100644 index 000000000000..a7e76ee9dc15 --- /dev/null +++ b/Vision/src/V1/CreateProductSetRequest.php @@ -0,0 +1,151 @@ +google.cloud.vision.v1.CreateProductSetRequest + */ +class CreateProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2; + */ + private $product_set = null; + /** + * 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 `/`. + * + * Generated from protobuf field string product_set_id = 3; + */ + private $product_set_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\ProductSet $product_set + * The ProductSet to create. + * @type string $product_set_id + * 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 `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project in which the ProductSet should be created. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2; + * @return \Google\Cloud\Vision\V1\ProductSet + */ + public function getProductSet() + { + return $this->product_set; + } + + /** + * The ProductSet to create. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 2; + * @param \Google\Cloud\Vision\V1\ProductSet $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_set = $var; + + return $this; + } + + /** + * 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 `/`. + * + * Generated from protobuf field string product_set_id = 3; + * @return string + */ + public function getProductSetId() + { + return $this->product_set_id; + } + + /** + * 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 `/`. + * + * Generated from protobuf field string product_set_id = 3; + * @param string $var + * @return $this + */ + public function setProductSetId($var) + { + GPBUtil::checkString($var, True); + $this->product_set_id = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/CreateReferenceImageRequest.php b/Vision/src/V1/CreateReferenceImageRequest.php new file mode 100644 index 000000000000..e440a89fcd2e --- /dev/null +++ b/Vision/src/V1/CreateReferenceImageRequest.php @@ -0,0 +1,159 @@ +google.cloud.vision.v1.CreateReferenceImageRequest + */ +class CreateReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2; + */ + private $reference_image = null; + /** + * 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 `/`. + * + * Generated from protobuf field string reference_image_id = 3; + */ + private $reference_image_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @type \Google\Cloud\Vision\V1\ReferenceImage $reference_image + * The reference image to create. + * If an image ID is specified, it is ignored. + * @type string $reference_image_id + * 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 `/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Resource name of the product in which to create the reference image. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2; + * @return \Google\Cloud\Vision\V1\ReferenceImage + */ + public function getReferenceImage() + { + return $this->reference_image; + } + + /** + * The reference image to create. + * If an image ID is specified, it is ignored. + * + * Generated from protobuf field .google.cloud.vision.v1.ReferenceImage reference_image = 2; + * @param \Google\Cloud\Vision\V1\ReferenceImage $var + * @return $this + */ + public function setReferenceImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_image = $var; + + return $this; + } + + /** + * 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 `/`. + * + * Generated from protobuf field string reference_image_id = 3; + * @return string + */ + public function getReferenceImageId() + { + return $this->reference_image_id; + } + + /** + * 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 `/`. + * + * Generated from protobuf field string reference_image_id = 3; + * @param string $var + * @return $this + */ + public function setReferenceImageId($var) + { + GPBUtil::checkString($var, True); + $this->reference_image_id = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/DeleteProductRequest.php b/Vision/src/V1/DeleteProductRequest.php new file mode 100644 index 000000000000..c22f20f9072e --- /dev/null +++ b/Vision/src/V1/DeleteProductRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.DeleteProductRequest + */ +class DeleteProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of product to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/DeleteProductSetRequest.php b/Vision/src/V1/DeleteProductSetRequest.php new file mode 100644 index 000000000000..fa89615222ed --- /dev/null +++ b/Vision/src/V1/DeleteProductSetRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.DeleteProductSetRequest + */ +class DeleteProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the ProductSet to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/DeleteReferenceImageRequest.php b/Vision/src/V1/DeleteReferenceImageRequest.php new file mode 100644 index 000000000000..636d5fdf3033 --- /dev/null +++ b/Vision/src/V1/DeleteReferenceImageRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.DeleteReferenceImageRequest + */ +class DeleteReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the reference image to delete. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/EntityAnnotation.php b/Vision/src/V1/EntityAnnotation.php index 4cbdb98f3509..b44962f90992 100644 --- a/Vision/src/V1/EntityAnnotation.php +++ b/Vision/src/V1/EntityAnnotation.php @@ -49,7 +49,7 @@ class EntityAnnotation extends \Google\Protobuf\Internal\Message * this field represents the confidence that there is a tower in the query * image. Range [0, 1]. * - * Generated from protobuf field float confidence = 5; + * Generated from protobuf field float confidence = 5 [deprecated = true]; */ private $confidence = 0.0; /** @@ -252,7 +252,7 @@ public function setScore($var) * this field represents the confidence that there is a tower in the query * image. Range [0, 1]. * - * Generated from protobuf field float confidence = 5; + * Generated from protobuf field float confidence = 5 [deprecated = true]; * @return float */ public function getConfidence() @@ -267,7 +267,7 @@ public function getConfidence() * this field represents the confidence that there is a tower in the query * image. Range [0, 1]. * - * Generated from protobuf field float confidence = 5; + * Generated from protobuf field float confidence = 5 [deprecated = true]; * @param float $var * @return $this */ diff --git a/Vision/src/V1/Feature/Type.php b/Vision/src/V1/Feature/Type.php index d56dc04ccffd..bd7373bb93dc 100644 --- a/Vision/src/V1/Feature/Type.php +++ b/Vision/src/V1/Feature/Type.php @@ -82,6 +82,12 @@ class Type * Generated from protobuf enum WEB_DETECTION = 10; */ const WEB_DETECTION = 10; + /** + * Run Product Search. + * + * Generated from protobuf enum PRODUCT_SEARCH = 12; + */ + const PRODUCT_SEARCH = 12; /** * Run localizer for object detection. * diff --git a/Vision/src/V1/Gapic/ProductSearchGapicClient.php b/Vision/src/V1/Gapic/ProductSearchGapicClient.php new file mode 100644 index 000000000000..22bff9b57dce --- /dev/null +++ b/Vision/src/V1/Gapic/ProductSearchGapicClient.php @@ -0,0 +1,1589 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $product = new Product(); + * $response = $productSearchClient->createProduct($formattedParent, $product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To assist + * with these names, this class includes a format method for each type of name, and additionally + * a parseName method to extract the individual identifiers contained within formatted names + * that are returned by the API. + * + * @experimental + */ +class ProductSearchGapicClient +{ + use GapicClientTrait; + + /** + * The name of the service. + */ + const SERVICE_NAME = 'google.cloud.vision.v1.ProductSearch'; + + /** + * The default address of the service. + */ + const SERVICE_ADDRESS = 'vision.googleapis.com'; + + /** + * The default port of the service. + */ + const DEFAULT_SERVICE_PORT = 443; + + /** + * The name of the code generator, to be included in the agent header. + */ + const CODEGEN_NAME = 'gapic'; + + /** + * The default scopes required by the service. + */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + private static $locationNameTemplate; + private static $productNameTemplate; + private static $productSetNameTemplate; + private static $imageNameTemplate; + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'serviceAddress' => self::SERVICE_ADDRESS.':'.self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__.'/../resources/product_search_client_config.json', + 'descriptorsConfigPath' => __DIR__.'/../resources/product_search_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__.'/../resources/product_search_grpc_config.json', + 'credentialsConfig' => [ + 'scopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__.'/../resources/product_search_rest_client_config.php', + ], + ], + ]; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getProductNameTemplate() + { + if (self::$productNameTemplate == null) { + self::$productNameTemplate = new PathTemplate('projects/{project}/locations/{location}/products/{product}'); + } + + return self::$productNameTemplate; + } + + private static function getProductSetNameTemplate() + { + if (self::$productSetNameTemplate == null) { + self::$productSetNameTemplate = new PathTemplate('projects/{project}/locations/{location}/productSets/{product_set}'); + } + + return self::$productSetNameTemplate; + } + + private static function getImageNameTemplate() + { + if (self::$imageNameTemplate == null) { + self::$imageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/products/{product}/referenceImages/{image}'); + } + + return self::$imageNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'location' => self::getLocationNameTemplate(), + 'product' => self::getProductNameTemplate(), + 'productSet' => self::getProductSetNameTemplate(), + 'image' => self::getImageNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent + * a location resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a product resource. + * + * @param string $project + * @param string $location + * @param string $product + * + * @return string The formatted product resource. + * @experimental + */ + public static function productName($project, $location, $product) + { + return self::getProductNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a product_set resource. + * + * @param string $project + * @param string $location + * @param string $productSet + * + * @return string The formatted product_set resource. + * @experimental + */ + public static function productSetName($project, $location, $productSet) + { + return self::getProductSetNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product_set' => $productSet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a image resource. + * + * @param string $project + * @param string $location + * @param string $product + * @param string $image + * + * @return string The formatted image resource. + * @experimental + */ + public static function imageName($project, $location, $product, $image) + { + return self::getImageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'product' => $product, + 'image' => $image, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - location: projects/{project}/locations/{location} + * - product: projects/{project}/locations/{location}/products/{product} + * - productSet: projects/{project}/locations/{location}/productSets/{product_set} + * - image: projects/{project}/locations/{location}/products/{product}/referenceImages/{image}. + * + * The optional $template argument can be supplied to specify a particular pattern, and must + * match one of the templates listed above. If no $template argument is provided, or if the + * $template argument does not match one of the templates listed, then parseName will check + * each of the supported templates, and return the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * @experimental + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * @experimental + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started + * by a long running API method. If $methodName is not provided, or does + * not match a long running API method, then the operation can still be + * resumed, but the OperationResponse object will not deserialize the + * final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + * @experimental + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $serviceAddress + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'vision.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the client. + * For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()}. + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either a + * path to a JSON file, or a PHP array containing the decoded JSON data. + * By default this settings points to the default client config file, which is provided + * in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string `rest` + * or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already instantiated + * {@see \Google\ApiCore\Transport\TransportInterface} object. Note that when this + * object is provided, any settings in $transportConfig, and any $serviceAddress + * setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...] + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * } + * + * @throws ValidationException + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $product = new Product(); + * $response = $productSearchClient->createProduct($formattedParent, $product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @param Product $product The product to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $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 `/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createProduct($parent, $product, array $optionalArgs = []) + { + $request = new CreateProductRequest(); + $request->setParent($parent); + $request->setProduct($product); + if (isset($optionalArgs['productId'])) { + $request->setProductId($optionalArgs['productId']); + } + + return $this->startCall( + 'CreateProduct', + Product::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProducts($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProducts($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listProducts($parent, array $optionalArgs = []) + { + $request = new ListProductsRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + return $this->getPagedListResponse( + 'ListProducts', + $optionalArgs, + ListProductsResponse::class, + $request + ); + } + + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $response = $productSearchClient->getProduct($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getProduct($name, array $optionalArgs = []) + { + $request = new GetProductRequest(); + $request->setName($name); + + return $this->startCall( + 'GetProduct', + Product::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $product = new Product(); + * $response = $productSearchClient->updateProduct($product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param Product $product The Product resource which replaces the one on the server. + * product.name is immutable. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\Product + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateProduct($product, array $optionalArgs = []) + { + $request = new UpdateProductRequest(); + $request->setProduct($product); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + return $this->startCall( + 'UpdateProduct', + Product::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $productSearchClient->deleteProduct($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteProduct($name, array $optionalArgs = []) + { + $request = new DeleteProductRequest(); + $request->setName($name); + + return $this->startCall( + 'DeleteProduct', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listReferenceImages($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listReferenceImages($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listReferenceImages($parent, array $optionalArgs = []) + { + $request = new ListReferenceImagesRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + return $this->getPagedListResponse( + 'ListReferenceImages', + $optionalArgs, + ListReferenceImagesResponse::class, + $request + ); + } + + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->imageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + * $response = $productSearchClient->getReferenceImage($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name The resource name of the ReferenceImage to get. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ReferenceImage + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getReferenceImage($name, array $optionalArgs = []) + { + $request = new GetReferenceImageRequest(); + $request->setName($name); + + return $this->startCall( + 'GetReferenceImage', + ReferenceImage::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->imageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + * $productSearchClient->deleteReferenceImage($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name The resource name of the reference image to delete. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteReferenceImage($name, array $optionalArgs = []) + { + $request = new DeleteReferenceImageRequest(); + $request->setName($name); + + return $this->startCall( + 'DeleteReferenceImage', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + * $referenceImage = new ReferenceImage(); + * $response = $productSearchClient->createReferenceImage($formattedParent, $referenceImage); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $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 $referenceImage The reference image to create. + * If an image ID is specified, it is ignored. + * @param array $optionalArgs { + * Optional. + * + * @type string $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 `/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ReferenceImage + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createReferenceImage($parent, $referenceImage, array $optionalArgs = []) + { + $request = new CreateReferenceImageRequest(); + $request->setParent($parent); + $request->setReferenceImage($referenceImage); + if (isset($optionalArgs['referenceImageId'])) { + $request->setReferenceImageId($optionalArgs['referenceImageId']); + } + + return $this->startCall( + 'CreateReferenceImage', + ReferenceImage::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $productSet = new ProductSet(); + * $response = $productSearchClient->createProductSet($formattedParent, $productSet); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param ProductSet $productSet The ProductSet to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $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 `/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function createProductSet($parent, $productSet, array $optionalArgs = []) + { + $request = new CreateProductSetRequest(); + $request->setParent($parent); + $request->setProductSet($productSet); + if (isset($optionalArgs['productSetId'])) { + $request->setProductSetId($optionalArgs['productSetId']); + } + + return $this->startCall( + 'CreateProductSet', + ProductSet::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProductSets($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProductSets($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listProductSets($parent, array $optionalArgs = []) + { + $request = new ListProductSetsRequest(); + $request->setParent($parent); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + return $this->getPagedListResponse( + 'ListProductSets', + $optionalArgs, + ListProductSetsResponse::class, + $request + ); + } + + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $response = $productSearchClient->getProductSet($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function getProductSet($name, array $optionalArgs = []) + { + $request = new GetProductSetRequest(); + $request->setName($name); + + return $this->startCall( + 'GetProductSet', + ProductSet::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $productSet = new ProductSet(); + * $response = $productSearchClient->updateProductSet($productSet); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param ProductSet $productSet The ProductSet resource which replaces the one on the server. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Vision\V1\ProductSet + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function updateProductSet($productSet, array $optionalArgs = []) + { + $request = new UpdateProductSetRequest(); + $request->setProductSet($productSet); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + return $this->startCall( + 'UpdateProductSet', + ProductSet::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Permanently deletes a ProductSet. All Products and ReferenceImages in the + * ProductSet will be 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $productSearchClient->deleteProductSet($formattedName); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function deleteProductSet($name, array $optionalArgs = []) + { + $request = new DeleteProductSetRequest(); + $request->setName($name); + + return $this->startCall( + 'DeleteProductSet', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $product = ''; + * $productSearchClient->addProductToProductSet($formattedName, $product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param string $product The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function addProductToProductSet($name, $product, array $optionalArgs = []) + { + $request = new AddProductToProductSetRequest(); + $request->setName($name); + $request->setProduct($product); + + return $this->startCall( + 'AddProductToProductSet', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Removes a Product from the specified ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND If the Product is not found under the ProductSet. + * + * Sample code: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * $product = ''; + * $productSearchClient->removeProductFromProductSet($formattedName, $product); + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param string $product The resource name for the Product to be removed from this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function removeProductFromProductSet($name, $product, array $optionalArgs = []) + { + $request = new RemoveProductFromProductSetRequest(); + $request->setName($name); + $request->setProduct($product); + + return $this->startCall( + 'RemoveProductFromProductSet', + GPBEmpty::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + * // Iterate over pages of elements + * $pagedResponse = $productSearchClient->listProductsInProductSet($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * + * + * // Alternatively: + * + * // Iterate through all elements + * $pagedResponse = $productSearchClient->listProductsInProductSet($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $name The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function listProductsInProductSet($name, array $optionalArgs = []) + { + $request = new ListProductsInProductSetRequest(); + $request->setName($name); + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + return $this->getPagedListResponse( + 'ListProductsInProductSet', + $optionalArgs, + ListProductsInProductSetResponse::class, + $request + ); + } + + /** + * 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: + * ``` + * $productSearchClient = new ProductSearchClient(); + * try { + * $formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]'); + * $inputConfig = new ImportProductSetsInputConfig(); + * $operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * + * + * // Alternatively: + * + * // start the operation, keep the operation name, and resume later + * $operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $productSearchClient->resumeOperation($operationName, 'importProductSets'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $productSearchClient->close(); + * } + * ``` + * + * @param string $parent The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param ImportProductSetsInputConfig $inputConfig The input content for the list of requests. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array + * of retry settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * @experimental + */ + public function importProductSets($parent, $inputConfig, array $optionalArgs = []) + { + $request = new ImportProductSetsRequest(); + $request->setParent($parent); + $request->setInputConfig($inputConfig); + + return $this->startOperationsCall( + 'ImportProductSets', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } +} diff --git a/Vision/src/V1/GetProductRequest.php b/Vision/src/V1/GetProductRequest.php new file mode 100644 index 000000000000..a8c225323402 --- /dev/null +++ b/Vision/src/V1/GetProductRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.GetProductRequest + */ +class GetProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the Product to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/GetProductSetRequest.php b/Vision/src/V1/GetProductSetRequest.php new file mode 100644 index 000000000000..12bc83343c30 --- /dev/null +++ b/Vision/src/V1/GetProductSetRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.GetProductSetRequest + */ +class GetProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Resource name of the ProductSet to get. + * Format is: + * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/GetReferenceImageRequest.php b/Vision/src/V1/GetReferenceImageRequest.php new file mode 100644 index 000000000000..9a18f2558bf5 --- /dev/null +++ b/Vision/src/V1/GetReferenceImageRequest.php @@ -0,0 +1,75 @@ +google.cloud.vision.v1.GetReferenceImageRequest + */ +class GetReferenceImageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ReferenceImage to get. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ImageAnnotatorGrpcClient.php b/Vision/src/V1/ImageAnnotatorGrpcClient.php index 887b76c0583f..954c27cb9847 100644 --- a/Vision/src/V1/ImageAnnotatorGrpcClient.php +++ b/Vision/src/V1/ImageAnnotatorGrpcClient.php @@ -2,7 +2,7 @@ // GENERATED CODE -- DO NOT EDIT! // Original file comments: -// Copyright 2018 Google Inc. +// 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. @@ -16,6 +16,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // +// namespace Google\Cloud\Vision\V1; /** diff --git a/Vision/src/V1/ImageContext.php b/Vision/src/V1/ImageContext.php index 9a4aaf1b78b4..a6749e988f28 100644 --- a/Vision/src/V1/ImageContext.php +++ b/Vision/src/V1/ImageContext.php @@ -40,6 +40,12 @@ class ImageContext extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.vision.v1.CropHintsParams crop_hints_params = 4; */ private $crop_hints_params = null; + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + */ + private $product_search_params = null; /** * Parameters for web detection. * @@ -66,6 +72,8 @@ class ImageContext extends \Google\Protobuf\Internal\Message * [supported languages](/vision/docs/languages). * @type \Google\Cloud\Vision\V1\CropHintsParams $crop_hints_params * Parameters for crop hints annotation request. + * @type \Google\Cloud\Vision\V1\ProductSearchParams $product_search_params + * Parameters for product search. * @type \Google\Cloud\Vision\V1\WebDetectionParams $web_detection_params * Parameters for web detection. * } @@ -167,6 +175,32 @@ public function setCropHintsParams($var) return $this; } + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + * @return \Google\Cloud\Vision\V1\ProductSearchParams + */ + public function getProductSearchParams() + { + return $this->product_search_params; + } + + /** + * Parameters for product search. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSearchParams product_search_params = 5; + * @param \Google\Cloud\Vision\V1\ProductSearchParams $var + * @return $this + */ + public function setProductSearchParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSearchParams::class); + $this->product_search_params = $var; + + return $this; + } + /** * Parameters for web detection. * diff --git a/Vision/src/V1/ImportProductSetsGcsSource.php b/Vision/src/V1/ImportProductSetsGcsSource.php new file mode 100644 index 000000000000..d9b048da433e --- /dev/null +++ b/Vision/src/V1/ImportProductSetsGcsSource.php @@ -0,0 +1,252 @@ +google.cloud.vision.v1.ImportProductSetsGcsSource + */ +class ImportProductSetsGcsSource extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + */ + private $csv_file_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $csv_file_uri + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + * @return string + */ + public function getCsvFileUri() + { + return $this->csv_file_uri; + } + + /** + * The Google Cloud Storage URI of the input csv file. + * The URI must start with `gs://`. + * The format of the input csv file should be one image per line. + * In each line, there are 8 columns. + * 1. image-uri + * 2. image-id + * 3. product-set-id + * 4. product-id + * 5. product-category + * 6. product-display-name + * 7. labels + * 8. bounding-poly + * The `image-uri`, `product-set-id`, `product-id`, and `product-category` + * columns are required. All other columns are optional. + * If the `ProductSet` or `Product` specified by the `product-set-id` and + * `product-id` values does not exist, then the system will create a new + * `ProductSet` or `Product` for the image. In this case, the + * `product-display-name` column refers to + * [display_name][google.cloud.vision.v1.Product.display_name], the + * `product-category` column refers to + * [product_category][google.cloud.vision.v1.Product.product_category], and the + * `labels` column refers to [product_labels][google.cloud.vision.v1.Product.product_labels]. + * The `image-id` column is optional but must be unique if provided. If it is + * empty, the system will automatically assign a unique id to the image. + * The `product-display-name` column is optional. If it is empty, the system + * sets the [display_name][google.cloud.vision.v1.Product.display_name] field for the product to a + * space (" "). You can update the `display_name` later by using the API. + * If a `Product` with the specified `product-id` already exists, then the + * system ignores the `product-display-name`, `product-category`, and `labels` + * columns. + * The `labels` column (optional) is a line containing a list of + * comma-separated key-value pairs, in the following format: + * "key_1=value_1,key_2=value_2,...,key_n=value_n" + * The `bounding-poly` column (optional) identifies one region of + * interest from the image in the same manner as `CreateReferenceImage`. If + * you do not specify the `bounding-poly` column, then the system will try to + * detect regions of interest automatically. + * At most one `bounding-poly` column is allowed per line. If the image + * contains multiple regions of interest, add a line to the CSV file that + * includes the same product information, and the `bounding-poly` values for + * each region of interest. + * The `bounding-poly` column must contain an even number of comma-separated + * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use + * non-negative integers for absolute bounding polygons, and float values + * in [0, 1] for normalized bounding polygons. + * The system will resize the image if the image resolution is too + * large to process (larger than 20MP). + * + * Generated from protobuf field string csv_file_uri = 1; + * @param string $var + * @return $this + */ + public function setCsvFileUri($var) + { + GPBUtil::checkString($var, True); + $this->csv_file_uri = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ImportProductSetsInputConfig.php b/Vision/src/V1/ImportProductSetsInputConfig.php new file mode 100644 index 000000000000..b19213771d4b --- /dev/null +++ b/Vision/src/V1/ImportProductSetsInputConfig.php @@ -0,0 +1,73 @@ +google.cloud.vision.v1.ImportProductSetsInputConfig + */ +class ImportProductSetsInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ImportProductSetsGcsSource $gcs_source + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsGcsSource gcs_source = 1; + * @return \Google\Cloud\Vision\V1\ImportProductSetsGcsSource + */ + public function getGcsSource() + { + return $this->readOneof(1); + } + + /** + * The Google Cloud Storage location for a csv file which preserves a list + * of ImportProductSetRequests in each line. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsGcsSource gcs_source = 1; + * @param \Google\Cloud\Vision\V1\ImportProductSetsGcsSource $var + * @return $this + */ + public function setGcsSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImportProductSetsGcsSource::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/Vision/src/V1/ImportProductSetsRequest.php b/Vision/src/V1/ImportProductSetsRequest.php new file mode 100644 index 000000000000..4b26857efb09 --- /dev/null +++ b/Vision/src/V1/ImportProductSetsRequest.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ImportProductSetsRequest + */ +class ImportProductSetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2; + */ + private $input_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $input_config + * The input content for the list of requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project in which the ProductSets should be imported. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2; + * @return \Google\Cloud\Vision\V1\ImportProductSetsInputConfig + */ + public function getInputConfig() + { + return $this->input_config; + } + + /** + * The input content for the list of requests. + * + * Generated from protobuf field .google.cloud.vision.v1.ImportProductSetsInputConfig input_config = 2; + * @param \Google\Cloud\Vision\V1\ImportProductSetsInputConfig $var + * @return $this + */ + public function setInputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ImportProductSetsInputConfig::class); + $this->input_config = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ImportProductSetsResponse.php b/Vision/src/V1/ImportProductSetsResponse.php new file mode 100644 index 000000000000..37b27a0cac1d --- /dev/null +++ b/Vision/src/V1/ImportProductSetsResponse.php @@ -0,0 +1,120 @@ +google.cloud.vision.v1.ImportProductSetsResponse + */ +class ImportProductSetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + */ + private $reference_images; + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + */ + private $statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $reference_images + * The list of reference_images that are imported successfully. + * @type \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $statuses + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferenceImages() + { + return $this->reference_images; + } + + /** + * The list of reference_images that are imported successfully. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @param \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferenceImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_images = $arr; + + return $this; + } + + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatuses() + { + return $this->statuses; + } + + /** + * The rpc status for each ImportProductSet request, including both successes + * and errors. + * The number of statuses here matches the number of lines in the csv file, + * and statuses[i] stores the success or failure status of processing the i-th + * line of the csv, starting from line 0. + * + * Generated from protobuf field repeated .google.rpc.Status statuses = 2; + * @param \Google\Rpc\Status[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->statuses = $arr; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListProductSetsRequest.php b/Vision/src/V1/ListProductSetsRequest.php new file mode 100644 index 000000000000..50d112249814 --- /dev/null +++ b/Vision/src/V1/ListProductSetsRequest.php @@ -0,0 +1,139 @@ +google.cloud.vision.v1.ListProductSetsRequest + */ +class ListProductSetsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project from which ProductSets should be listed. + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListProductSetsResponse.php b/Vision/src/V1/ListProductSetsResponse.php new file mode 100644 index 000000000000..9888294497ac --- /dev/null +++ b/Vision/src/V1/ListProductSetsResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductSetsResponse + */ +class ListProductSetsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + */ + private $product_sets; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSet[]|\Google\Protobuf\Internal\RepeatedField $product_sets + * List of ProductSets. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductSets() + { + return $this->product_sets; + } + + /** + * List of ProductSets. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSet product_sets = 1; + * @param \Google\Cloud\Vision\V1\ProductSet[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductSets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_sets = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListProductsInProductSetRequest.php b/Vision/src/V1/ListProductsInProductSetRequest.php new file mode 100644 index 000000000000..8ae6f95a6974 --- /dev/null +++ b/Vision/src/V1/ListProductsInProductSetRequest.php @@ -0,0 +1,143 @@ +google.cloud.vision.v1.ListProductsInProductSetRequest + */ +class ListProductsInProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The ProductSet resource for which to retrieve Products. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListProductsInProductSetResponse.php b/Vision/src/V1/ListProductsInProductSetResponse.php new file mode 100644 index 000000000000..947c57129bd3 --- /dev/null +++ b/Vision/src/V1/ListProductsInProductSetResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductsInProductSetResponse + */ +class ListProductsInProductSetResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + */ + private $products; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $products + * The list of Products. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducts() + { + return $this->products; + } + + /** + * The list of Products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @param \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class); + $this->products = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListProductsRequest.php b/Vision/src/V1/ListProductsRequest.php new file mode 100644 index 000000000000..46552a6f8a1f --- /dev/null +++ b/Vision/src/V1/ListProductsRequest.php @@ -0,0 +1,143 @@ +google.cloud.vision.v1.ListProductsRequest + */ +class ListProductsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * The project OR ProductSet from which Products should be listed. + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListProductsResponse.php b/Vision/src/V1/ListProductsResponse.php new file mode 100644 index 000000000000..cff11ed79548 --- /dev/null +++ b/Vision/src/V1/ListProductsResponse.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ListProductsResponse + */ +class ListProductsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + */ + private $products; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $products + * List of products. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProducts() + { + return $this->products; + } + + /** + * List of products. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product products = 1; + * @param \Google\Cloud\Vision\V1\Product[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product::class); + $this->products = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListReferenceImagesRequest.php b/Vision/src/V1/ListReferenceImagesRequest.php new file mode 100644 index 000000000000..fe315197fdd3 --- /dev/null +++ b/Vision/src/V1/ListReferenceImagesRequest.php @@ -0,0 +1,151 @@ +google.cloud.vision.v1.ListReferenceImagesRequest + */ +class ListReferenceImagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1; + */ + private $parent = ''; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $page_token + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Resource name of the product containing the reference images. + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * + * Generated from protobuf field string parent = 1; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * Defaults to the first page if not specified. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ListReferenceImagesResponse.php b/Vision/src/V1/ListReferenceImagesResponse.php new file mode 100644 index 000000000000..b5afa77c0597 --- /dev/null +++ b/Vision/src/V1/ListReferenceImagesResponse.php @@ -0,0 +1,135 @@ +google.cloud.vision.v1.ListReferenceImagesResponse + */ +class ListReferenceImagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + */ + private $reference_images; + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $reference_images + * The list of reference images. + * @type int $page_size + * The maximum number of items to return. Default 10, maximum 100. + * @type string $next_page_token + * The next_page_token returned from a previous List request, if any. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferenceImages() + { + return $this->reference_images; + } + + /** + * The list of reference images. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ReferenceImage reference_images = 1; + * @param \Google\Cloud\Vision\V1\ReferenceImage[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferenceImages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ReferenceImage::class); + $this->reference_images = $arr; + + return $this; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. Default 10, maximum 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The next_page_token returned from a previous List request, if any. + * + * Generated from protobuf field string next_page_token = 3; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/Product.php b/Vision/src/V1/Product.php new file mode 100644 index 000000000000..4746a3e8d7ea --- /dev/null +++ b/Vision/src/V1/Product.php @@ -0,0 +1,255 @@ +google.cloud.vision.v1.Product + */ +class Product extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + */ + private $description = ''; + /** + * The category for the product identified by the reference image. This should + * be either "homegoods", "apparel", or "toys". + * This field is immutable. + * + * Generated from protobuf field string product_category = 4; + */ + private $product_category = ''; + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 100 product_labels. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + */ + private $product_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * @type string $display_name + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * @type string $description + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * @type string $product_category + * The category for the product identified by the reference image. This should + * be either "homegoods", "apparel", or "toys". + * This field is immutable. + * @type \Google\Cloud\Vision\V1\Product\KeyValue[]|\Google\Protobuf\Internal\RepeatedField $product_labels + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 100 product_labels. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the product. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * This field is ignored when creating a product. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user-provided name for this Product. Must not be empty. Must be at most + * 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided metadata to be stored with this product. Must be at most 4096 + * characters long. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The category for the product identified by the reference image. This should + * be either "homegoods", "apparel", or "toys". + * This field is immutable. + * + * Generated from protobuf field string product_category = 4; + * @return string + */ + public function getProductCategory() + { + return $this->product_category; + } + + /** + * The category for the product identified by the reference image. This should + * be either "homegoods", "apparel", or "toys". + * This field is immutable. + * + * Generated from protobuf field string product_category = 4; + * @param string $var + * @return $this + */ + public function setProductCategory($var) + { + GPBUtil::checkString($var, True); + $this->product_category = $var; + + return $this; + } + + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 100 product_labels. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductLabels() + { + return $this->product_labels; + } + + /** + * Key-value pairs that can be attached to a product. At query time, + * constraints can be specified based on the product_labels. + * Note that integer values can be provided as strings, e.g. "1199". Only + * strings with integer values can match a range-based restriction which is + * to be supported soon. + * Multiple values can be assigned to the same key. One product may have up to + * 100 product_labels. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.Product.KeyValue product_labels = 5; + * @param \Google\Cloud\Vision\V1\Product\KeyValue[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\Product\KeyValue::class); + $this->product_labels = $arr; + + return $this; + } + +} + diff --git a/Vision/src/V1/Product/KeyValue.php b/Vision/src/V1/Product/KeyValue.php new file mode 100644 index 000000000000..5a68dab618c2 --- /dev/null +++ b/Vision/src/V1/Product/KeyValue.php @@ -0,0 +1,112 @@ +google.cloud.vision.v1.Product.KeyValue + */ +class KeyValue extends \Google\Protobuf\Internal\Message +{ + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + */ + private $key = ''; + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + */ + private $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * @type string $value + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * The key of the label attached to the product. Cannot be empty and cannot + * exceed 128 bytes. + * + * Generated from protobuf field string key = 1; + * @param string $var + * @return $this + */ + public function setKey($var) + { + GPBUtil::checkString($var, True); + $this->key = $var; + + return $this; + } + + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The value of the label attached to the product. Cannot be empty and + * cannot exceed 128 bytes. + * + * Generated from protobuf field string value = 2; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(KeyValue::class, \Google\Cloud\Vision\V1\Product_KeyValue::class); + diff --git a/Vision/src/V1/ProductSearchClient.php b/Vision/src/V1/ProductSearchClient.php new file mode 100644 index 000000000000..089dba1d74e8 --- /dev/null +++ b/Vision/src/V1/ProductSearchClient.php @@ -0,0 +1,38 @@ +_simpleRequest('/google.cloud.vision.v1.ProductSearch/CreateProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ProductSet', 'decode'], + $metadata, $options); + } + + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * @param \Google\Cloud\Vision\V1\ListProductSetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListProductSets(\Google\Cloud\Vision\V1\ListProductSetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListProductSets', + $argument, + ['\Google\Cloud\Vision\V1\ListProductSetsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * @param \Google\Cloud\Vision\V1\GetProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetProductSet(\Google\Cloud\Vision\V1\GetProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/GetProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ProductSet', 'decode'], + $metadata, $options); + } + + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * @param \Google\Cloud\Vision\V1\UpdateProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateProductSet(\Google\Cloud\Vision\V1\UpdateProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/UpdateProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ProductSet', 'decode'], + $metadata, $options); + } + + /** + * Permanently deletes a ProductSet. All Products and ReferenceImages in the + * ProductSet will be deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * @param \Google\Cloud\Vision\V1\DeleteProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function DeleteProductSet(\Google\Cloud\Vision\V1\DeleteProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/DeleteProductSet', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\CreateProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CreateProduct(\Google\Cloud\Vision\V1\CreateProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/CreateProduct', + $argument, + ['\Google\Cloud\Vision\V1\Product', 'decode'], + $metadata, $options); + } + + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * @param \Google\Cloud\Vision\V1\ListProductsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListProducts(\Google\Cloud\Vision\V1\ListProductsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListProducts', + $argument, + ['\Google\Cloud\Vision\V1\ListProductsResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * @param \Google\Cloud\Vision\V1\GetProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetProduct(\Google\Cloud\Vision\V1\GetProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/GetProduct', + $argument, + ['\Google\Cloud\Vision\V1\Product', 'decode'], + $metadata, $options); + } + + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * @param \Google\Cloud\Vision\V1\UpdateProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function UpdateProduct(\Google\Cloud\Vision\V1\UpdateProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/UpdateProduct', + $argument, + ['\Google\Cloud\Vision\V1\Product', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\DeleteProductRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function DeleteProduct(\Google\Cloud\Vision\V1\DeleteProductRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/DeleteProduct', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\CreateReferenceImageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function CreateReferenceImage(\Google\Cloud\Vision\V1\CreateReferenceImageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/CreateReferenceImage', + $argument, + ['\Google\Cloud\Vision\V1\ReferenceImage', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\DeleteReferenceImageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function DeleteReferenceImage(\Google\Cloud\Vision\V1\DeleteReferenceImageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/DeleteReferenceImage', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\ListReferenceImagesRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListReferenceImages(\Google\Cloud\Vision\V1\ListReferenceImagesRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListReferenceImages', + $argument, + ['\Google\Cloud\Vision\V1\ListReferenceImagesResponse', 'decode'], + $metadata, $options); + } + + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * @param \Google\Cloud\Vision\V1\GetReferenceImageRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function GetReferenceImage(\Google\Cloud\Vision\V1\GetReferenceImageRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/GetReferenceImage', + $argument, + ['\Google\Cloud\Vision\V1\ReferenceImage', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\AddProductToProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function AddProductToProductSet(\Google\Cloud\Vision\V1\AddProductToProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/AddProductToProductSet', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * Removes a Product from the specified ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND If the Product is not found under the ProductSet. + * @param \Google\Cloud\Vision\V1\RemoveProductFromProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function RemoveProductFromProductSet(\Google\Cloud\Vision\V1\RemoveProductFromProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet', + $argument, + ['\Google\Protobuf\GPBEmpty', 'decode'], + $metadata, $options); + } + + /** + * 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. + * @param \Google\Cloud\Vision\V1\ListProductsInProductSetRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ListProductsInProductSet(\Google\Cloud\Vision\V1\ListProductsInProductSetRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ListProductsInProductSet', + $argument, + ['\Google\Cloud\Vision\V1\ListProductsInProductSetResponse', 'decode'], + $metadata, $options); + } + + /** + * 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]. + * @param \Google\Cloud\Vision\V1\ImportProductSetsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + */ + public function ImportProductSets(\Google\Cloud\Vision\V1\ImportProductSetsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.vision.v1.ProductSearch/ImportProductSets', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + +} diff --git a/Vision/src/V1/ProductSearchParams.php b/Vision/src/V1/ProductSearchParams.php new file mode 100644 index 000000000000..b84d2e12a225 --- /dev/null +++ b/Vision/src/V1/ProductSearchParams.php @@ -0,0 +1,205 @@ +google.cloud.vision.v1.ProductSearchParams + */ +class ProductSearchParams extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the area of interest in the image. + * Optional. If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + */ + private $bounding_poly = null; + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6; + */ + private $product_set = ''; + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods", "apparel", or "toys" should be + * specified. + * + * Generated from protobuf field repeated string product_categories = 7; + */ + private $product_categories; + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but not "(color = red OR brand = Google)" or "color: red". + * + * Generated from protobuf field string filter = 8; + */ + private $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the area of interest in the image. + * Optional. If it is not specified, system discretion will be applied. + * @type string $product_set + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $product_categories + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods", "apparel", or "toys" should be + * specified. + * @type string $filter + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but not "(color = red OR brand = Google)" or "color: red". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the area of interest in the image. + * Optional. If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + * @return \Google\Cloud\Vision\V1\BoundingPoly + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + /** + * The bounding polygon around the area of interest in the image. + * Optional. If it is not specified, system discretion will be applied. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 9; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6; + * @return string + */ + public function getProductSet() + { + return $this->product_set; + } + + /** + * The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * + * Generated from protobuf field string product_set = 6; + * @param string $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkString($var, True); + $this->product_set = $var; + + return $this; + } + + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods", "apparel", or "toys" should be + * specified. + * + * Generated from protobuf field repeated string product_categories = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductCategories() + { + return $this->product_categories; + } + + /** + * The list of product categories to search in. Currently, we only consider + * the first category, and either "homegoods", "apparel", or "toys" should be + * specified. + * + * Generated from protobuf field repeated string product_categories = 7; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductCategories($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_categories = $arr; + + return $this; + } + + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but not "(color = red OR brand = Google)" or "color: red". + * + * Generated from protobuf field string filter = 8; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filtering expression. This can be used to restrict search results based + * on Product labels. We currently support an AND of OR of key-value + * expressions, where each expression within an OR must have the same key. + * For example, "(color = red OR color = blue) AND brand = Google" is + * acceptable, but not "(color = red OR brand = Google)" or "color: red". + * + * Generated from protobuf field string filter = 8; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/ProductSearchResults.php b/Vision/src/V1/ProductSearchResults.php new file mode 100644 index 000000000000..83cab2b3cdaf --- /dev/null +++ b/Vision/src/V1/ProductSearchResults.php @@ -0,0 +1,151 @@ +google.cloud.vision.v1.ProductSearchResults + */ +class ProductSearchResults extends \Google\Protobuf\Internal\Message +{ + /** + * Timestamp of the index which provided these results. Changes made after + * this time are not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + */ + private $index_time = null; + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + */ + private $results; + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + */ + private $product_grouped_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $index_time + * Timestamp of the index which provided these results. Changes made after + * this time are not reflected in the current results. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $results + * List of results, one for each product match. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult[]|\Google\Protobuf\Internal\RepeatedField $product_grouped_results + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * Timestamp of the index which provided these results. Changes made after + * this time are not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + * @return \Google\Protobuf\Timestamp + */ + public function getIndexTime() + { + return $this->index_time; + } + + /** + * Timestamp of the index which provided these results. Changes made after + * this time are not reflected in the current results. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setIndexTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->index_time = $var; + + return $this; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 5; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class); + $this->results = $arr; + + return $this; + } + + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductGroupedResults() + { + return $this->product_grouped_results; + } + + /** + * List of results grouped by products detected in the query image. Each entry + * corresponds to one bounding polygon in the query image, and contains the + * matching products specific to that region. There may be duplicate product + * matches in the union of all the per-product results. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.GroupedResult product_grouped_results = 6; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductGroupedResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\GroupedResult::class); + $this->product_grouped_results = $arr; + + return $this; + } + +} + diff --git a/Vision/src/V1/ProductSearchResults/GroupedResult.php b/Vision/src/V1/ProductSearchResults/GroupedResult.php new file mode 100644 index 000000000000..373d99c2ca64 --- /dev/null +++ b/Vision/src/V1/ProductSearchResults/GroupedResult.php @@ -0,0 +1,105 @@ +google.cloud.vision.v1.ProductSearchResults.GroupedResult + */ +class GroupedResult extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + */ + private $bounding_poly = null; + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + */ + private $results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\BoundingPoly $bounding_poly + * The bounding polygon around the product detected in the query image. + * @type \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $results + * List of results, one for each product match. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @return \Google\Cloud\Vision\V1\BoundingPoly + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + /** + * The bounding polygon around the product detected in the query image. + * + * Generated from protobuf field .google.cloud.vision.v1.BoundingPoly bounding_poly = 1; + * @param \Google\Cloud\Vision\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * List of results, one for each product match. + * + * Generated from protobuf field repeated .google.cloud.vision.v1.ProductSearchResults.Result results = 2; + * @param \Google\Cloud\Vision\V1\ProductSearchResults\Result[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\ProductSearchResults\Result::class); + $this->results = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GroupedResult::class, \Google\Cloud\Vision\V1\ProductSearchResults_GroupedResult::class); + diff --git a/Vision/src/V1/ProductSearchResults/Result.php b/Vision/src/V1/ProductSearchResults/Result.php new file mode 100644 index 000000000000..a9a27397710c --- /dev/null +++ b/Vision/src/V1/ProductSearchResults/Result.php @@ -0,0 +1,146 @@ +google.cloud.vision.v1.ProductSearchResults.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + */ + private $product = null; + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + */ + private $score = 0.0; + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + */ + private $image = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product $product + * The Product. + * @type float $score + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * @type string $image + * The resource name of the image from the product that is the closest match + * to the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearch::initOnce(); + parent::__construct($data); + } + + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @return \Google\Cloud\Vision\V1\Product + */ + public function getProduct() + { + return $this->product; + } + + /** + * The Product. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * A confidence level on the match, ranging from 0 (no confidence) to + * 1 (full confidence). + * + * Generated from protobuf field float score = 2; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + * @return string + */ + public function getImage() + { + return $this->image; + } + + /** + * The resource name of the image from the product that is the closest match + * to the query. + * + * Generated from protobuf field string image = 3; + * @param string $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkString($var, True); + $this->image = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Result::class, \Google\Cloud\Vision\V1\ProductSearchResults_Result::class); + diff --git a/Vision/src/V1/ProductSearchResults_GroupedResult.php b/Vision/src/V1/ProductSearchResults_GroupedResult.php new file mode 100644 index 000000000000..82125013a71b --- /dev/null +++ b/Vision/src/V1/ProductSearchResults_GroupedResult.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.ProductSet + */ +class ProductSet extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + */ + private $display_name = ''; + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this field is 0. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3; + */ + private $index_time = null; + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4; + */ + private $index_error = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * @type string $display_name + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * @type \Google\Protobuf\Timestamp $index_time + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this field is 0. + * This field is ignored when creating a ProductSet. + * @type \Google\Rpc\Status $index_error + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The user-provided name for this ProductSet. Must not be empty. Must be at + * most 4096 characters long. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this field is 0. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3; + * @return \Google\Protobuf\Timestamp + */ + public function getIndexTime() + { + return $this->index_time; + } + + /** + * Output only. The time at which this ProductSet was last indexed. Query + * results will reflect all updates before this time. If this ProductSet has + * never been indexed, this field is 0. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.protobuf.Timestamp index_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setIndexTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->index_time = $var; + + return $this; + } + + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4; + * @return \Google\Rpc\Status + */ + public function getIndexError() + { + return $this->index_error; + } + + /** + * Output only. If there was an error with indexing the product set, the field + * is populated. + * This field is ignored when creating a ProductSet. + * + * Generated from protobuf field .google.rpc.Status index_error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setIndexError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->index_error = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/Product_KeyValue.php b/Vision/src/V1/Product_KeyValue.php new file mode 100644 index 000000000000..694da6b21398 --- /dev/null +++ b/Vision/src/V1/Product_KeyValue.php @@ -0,0 +1,16 @@ +google.cloud.vision.v1.ReferenceImage + */ +class ReferenceImage extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * Required. + * + * Generated from protobuf field string uri = 2; + */ + private $uri = ''; + /** + * Bounding polygons around the areas of interest in the reference image. + * Optional. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3; + */ + private $bounding_polys; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * @type string $uri + * The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * Required. + * @type \Google\Cloud\Vision\V1\BoundingPoly[]|\Google\Protobuf\Internal\RepeatedField $bounding_polys + * Bounding polygons around the areas of interest in the reference image. + * Optional. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the reference image. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * This field is ignored when creating a reference image. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * Required. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The Google Cloud Storage URI of the reference image. + * The URI must start with `gs://`. + * Required. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Bounding polygons around the areas of interest in the reference image. + * Optional. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBoundingPolys() + { + return $this->bounding_polys; + } + + /** + * Bounding polygons around the areas of interest in the reference image. + * Optional. If this field is empty, the system will try to detect regions of + * interest. At most 10 bounding polygons will be used. + * The provided shape is converted into a non-rotated rectangle. Once + * converted, the small edge of the rectangle must be greater than or equal + * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 + * is not). + * + * Generated from protobuf field repeated .google.cloud.vision.v1.BoundingPoly bounding_polys = 3; + * @param \Google\Cloud\Vision\V1\BoundingPoly[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBoundingPolys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Vision\V1\BoundingPoly::class); + $this->bounding_polys = $arr; + + return $this; + } + +} + diff --git a/Vision/src/V1/RemoveProductFromProductSetRequest.php b/Vision/src/V1/RemoveProductFromProductSetRequest.php new file mode 100644 index 000000000000..48ceafba54a9 --- /dev/null +++ b/Vision/src/V1/RemoveProductFromProductSetRequest.php @@ -0,0 +1,117 @@ +google.cloud.vision.v1.RemoveProductFromProductSetRequest + */ +class RemoveProductFromProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + */ + private $name = ''; + /** + * The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2; + */ + private $product = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @type string $product + * The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name for the ProductSet to modify. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2; + * @return string + */ + public function getProduct() + { + return $this->product; + } + + /** + * The resource name for the Product to be removed from this ProductSet. + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * + * Generated from protobuf field string product = 2; + * @param string $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkString($var, True); + $this->product = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/UpdateProductRequest.php b/Vision/src/V1/UpdateProductRequest.php new file mode 100644 index 000000000000..fc3a5c91c52b --- /dev/null +++ b/Vision/src/V1/UpdateProductRequest.php @@ -0,0 +1,121 @@ +google.cloud.vision.v1.UpdateProductRequest + */ +class UpdateProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + */ + private $product = null; + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\Product $product + * The Product resource which replaces the one on the server. + * product.name is immutable. + * @type \Google\Protobuf\FieldMask $update_mask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @return \Google\Cloud\Vision\V1\Product + */ + public function getProduct() + { + return $this->product; + } + + /** + * The Product resource which replaces the one on the server. + * product.name is immutable. + * + * Generated from protobuf field .google.cloud.vision.v1.Product product = 1; + * @param \Google\Cloud\Vision\V1\Product $var + * @return $this + */ + public function setProduct($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\Product::class); + $this->product = $var; + + return $this; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/UpdateProductSetRequest.php b/Vision/src/V1/UpdateProductSetRequest.php new file mode 100644 index 000000000000..b53910e95b2e --- /dev/null +++ b/Vision/src/V1/UpdateProductSetRequest.php @@ -0,0 +1,113 @@ +google.cloud.vision.v1.UpdateProductSetRequest + */ +class UpdateProductSetRequest extends \Google\Protobuf\Internal\Message +{ + /** + * The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1; + */ + private $product_set = null; + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + private $update_mask = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Vision\V1\ProductSet $product_set + * The ProductSet resource which replaces the one on the server. + * @type \Google\Protobuf\FieldMask $update_mask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Vision\V1\ProductSearchService::initOnce(); + parent::__construct($data); + } + + /** + * The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1; + * @return \Google\Cloud\Vision\V1\ProductSet + */ + public function getProductSet() + { + return $this->product_set; + } + + /** + * The ProductSet resource which replaces the one on the server. + * + * Generated from protobuf field .google.cloud.vision.v1.ProductSet product_set = 1; + * @param \Google\Cloud\Vision\V1\ProductSet $var + * @return $this + */ + public function setProductSet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Vision\V1\ProductSet::class); + $this->product_set = $var; + + return $this; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + /** + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/Vision/src/V1/WebDetection.php b/Vision/src/V1/WebDetection.php index 448637e67ca7..cc377007332b 100644 --- a/Vision/src/V1/WebDetection.php +++ b/Vision/src/V1/WebDetection.php @@ -49,7 +49,8 @@ class WebDetection extends \Google\Protobuf\Internal\Message */ private $visually_similar_images; /** - * Best guess text labels for the request image. + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. * * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; */ @@ -75,7 +76,8 @@ class WebDetection extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Vision\V1\WebDetection\WebImage[]|\Google\Protobuf\Internal\RepeatedField $visually_similar_images * The visually similar image results. * @type \Google\Cloud\Vision\V1\WebDetection\WebLabel[]|\Google\Protobuf\Internal\RepeatedField $best_guess_labels - * Best guess text labels for the request image. + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. * } */ public function __construct($data = NULL) { @@ -220,7 +222,8 @@ public function setVisuallySimilarImages($var) } /** - * Best guess text labels for the request image. + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. * * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; * @return \Google\Protobuf\Internal\RepeatedField @@ -231,7 +234,8 @@ public function getBestGuessLabels() } /** - * Best guess text labels for the request image. + * The service's best guess as to the topic of the request image. + * Inferred from similar images on the open web. * * Generated from protobuf field repeated .google.cloud.vision.v1.WebDetection.WebLabel best_guess_labels = 8; * @param \Google\Cloud\Vision\V1\WebDetection\WebLabel[]|\Google\Protobuf\Internal\RepeatedField $var diff --git a/Vision/src/V1/resources/product_search_client_config.json b/Vision/src/V1/resources/product_search_client_config.json new file mode 100644 index 000000000000..77e2a4fe3316 --- /dev/null +++ b/Vision/src/V1/resources/product_search_client_config.json @@ -0,0 +1,116 @@ +{ + "interfaces": { + "google.cloud.vision.v1.ProductSearch": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProducts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteProduct": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListReferenceImages": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetReferenceImage": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteReferenceImage": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateReferenceImage": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProductSets": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AddProductToProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RemoveProductFromProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListProductsInProductSet": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ImportProductSets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/Vision/src/V1/resources/product_search_descriptor_config.php b/Vision/src/V1/resources/product_search_descriptor_config.php new file mode 100644 index 000000000000..57fd82b2b779 --- /dev/null +++ b/Vision/src/V1/resources/product_search_descriptor_config.php @@ -0,0 +1,58 @@ + [ + 'google.cloud.vision.v1.ProductSearch' => [ + 'ImportProductSets' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Vision\V1\ImportProductSetsResponse', + 'metadataReturnType' => '\Google\Cloud\Vision\V1\BatchOperationMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + ], + 'ListProducts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProducts', + ], + ], + 'ListReferenceImages' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getReferenceImages', + ], + ], + 'ListProductSets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProductSets', + ], + ], + 'ListProductsInProductSet' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProducts', + ], + ], + ], + ], +]; diff --git a/Vision/src/V1/resources/product_search_rest_client_config.php b/Vision/src/V1/resources/product_search_rest_client_config.php new file mode 100644 index 000000000000..a092bb771dfe --- /dev/null +++ b/Vision/src/V1/resources/product_search_rest_client_config.php @@ -0,0 +1,235 @@ + [ + 'google.cloud.vision.v1.ProductSearch' => [ + 'CreateProduct' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products', + 'body' => 'product', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProducts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/products', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetProduct' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateProduct' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{product.name=projects/*/locations/*/products/*}', + 'body' => 'product', + 'placeholders' => [ + 'product.name' => [ + 'getters' => [ + 'getProduct', + 'getName', + ], + ], + ], + ], + 'DeleteProduct' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListReferenceImages' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/products/*}/referenceImages', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetReferenceImage' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*/referenceImages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteReferenceImage' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/products/*/referenceImages/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateReferenceImage' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/products/*}/referenceImages', + 'body' => 'reference_image', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets', + 'body' => 'product_set', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductSets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetProductSet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateProductSet' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{product_set.name=projects/*/locations/*/productSets/*}', + 'body' => 'product_set', + 'placeholders' => [ + 'product_set.name' => [ + 'getters' => [ + 'getProductSet', + 'getName', + ], + ], + ], + ], + 'DeleteProductSet' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'AddProductToProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}:addProduct', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'RemoveProductFromProductSet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}:removeProduct', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListProductsInProductSet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/productSets/*}/products', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ImportProductSets' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/productSets:import', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], +]; diff --git a/Vision/tests/Unit/V1/ProductSearchClientTest.php b/Vision/tests/Unit/V1/ProductSearchClientTest.php new file mode 100644 index 000000000000..934c8e49de1a --- /dev/null +++ b/Vision/tests/Unit/V1/ProductSearchClientTest.php @@ -0,0 +1,1522 @@ + $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(), + ]; + + return new ProductSearchClient($options); + } + + /** + * @test + */ + public function createProductTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + $product = new Product(); + + $response = $client->createProduct($formattedParent, $product); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateProduct', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + + $this->assertProtobufEquals($product, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createProductExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + $product = new Product(); + + try { + $client->createProduct($formattedParent, $product); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listProductsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $productsElement = new Product(); + $products = [$productsElement]; + $expectedResponse = new ListProductsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProducts($products); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + + $response = $client->listProducts($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProducts()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProducts', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listProductsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + + try { + $client->listProducts($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getProductTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + $response = $client->getProduct($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetProduct', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getProductExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + try { + $client->getProduct($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateProductTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $productCategory = 'productCategory-1607451058'; + $expectedResponse = new Product(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setProductCategory($productCategory); + $transport->addResponse($expectedResponse); + + // Mock request + $product = new Product(); + + $response = $client->updateProduct($product); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/UpdateProduct', $actualFuncCall); + + $actualValue = $actualRequestObject->getProduct(); + + $this->assertProtobufEquals($product, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateProductExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $product = new Product(); + + try { + $client->updateProduct($product); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteProductTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + $client->deleteProduct($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteProduct', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteProductExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + try { + $client->deleteProduct($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listReferenceImagesTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $pageSize = 883849137; + $nextPageToken = ''; + $referenceImagesElement = new ReferenceImage(); + $referenceImages = [$referenceImagesElement]; + $expectedResponse = new ListReferenceImagesResponse(); + $expectedResponse->setPageSize($pageSize); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setReferenceImages($referenceImages); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + $response = $client->listReferenceImages($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getReferenceImages()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListReferenceImages', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listReferenceImagesExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + + try { + $client->listReferenceImages($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getReferenceImageTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $uri = 'uri116076'; + $expectedResponse = new ReferenceImage(); + $expectedResponse->setName($name2); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->imageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + + $response = $client->getReferenceImage($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetReferenceImage', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getReferenceImageExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->imageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + + try { + $client->getReferenceImage($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteReferenceImageTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->imageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + + $client->deleteReferenceImage($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteReferenceImage', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteReferenceImageExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->imageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[IMAGE]'); + + try { + $client->deleteReferenceImage($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createReferenceImageTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $uri = 'uri116076'; + $expectedResponse = new ReferenceImage(); + $expectedResponse->setName($name); + $expectedResponse->setUri($uri); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImage = new ReferenceImage(); + + $response = $client->createReferenceImage($formattedParent, $referenceImage); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateReferenceImage', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getReferenceImage(); + + $this->assertProtobufEquals($referenceImage, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createReferenceImageExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]'); + $referenceImage = new ReferenceImage(); + + try { + $client->createReferenceImage($formattedParent, $referenceImage); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + $productSet = new ProductSet(); + + $response = $client->createProductSet($formattedParent, $productSet); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/CreateProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProductSet(); + + $this->assertProtobufEquals($productSet, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function createProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + $productSet = new ProductSet(); + + try { + $client->createProductSet($formattedParent, $productSet); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listProductSetsTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $productSetsElement = new ProductSet(); + $productSets = [$productSetsElement]; + $expectedResponse = new ListProductSetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProductSets($productSets); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + + $response = $client->listProductSets($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProductSets()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProductSets', $actualFuncCall); + + $actualValue = $actualRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listProductSetsExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + + try { + $client->listProductSets($formattedParent); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + $response = $client->getProductSet($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/GetProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function getProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + try { + $client->getProductSet($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ProductSet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + + // Mock request + $productSet = new ProductSet(); + + $response = $client->updateProductSet($productSet); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/UpdateProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getProductSet(); + + $this->assertProtobufEquals($productSet, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function updateProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $productSet = new ProductSet(); + + try { + $client->updateProductSet($productSet); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + $client->deleteProductSet($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/DeleteProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function deleteProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + try { + $client->deleteProductSet($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function addProductToProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $product = 'product-309474065'; + + $client->addProductToProductSet($formattedName, $product); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/AddProductToProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + + $this->assertProtobufEquals($product, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function addProductToProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $product = 'product-309474065'; + + try { + $client->addProductToProductSet($formattedName, $product); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function removeProductFromProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $product = 'product-309474065'; + + $client->removeProductFromProductSet($formattedName, $product); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/RemoveProductFromProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getProduct(); + + $this->assertProtobufEquals($product, $actualValue); + + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function removeProductFromProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + $product = 'product-309474065'; + + try { + $client->removeProductFromProductSet($formattedName, $product); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listProductsInProductSetTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + // Mock response + $nextPageToken = ''; + $productsElement = new Product(); + $products = [$productsElement]; + $expectedResponse = new ListProductsInProductSetResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProducts($products); + $transport->addResponse($expectedResponse); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + $response = $client->listProductsInProductSet($formattedName); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProducts()[0], $resources[0]); + + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ListProductsInProductSet', $actualFuncCall); + + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function listProductsInProductSetExceptionTest() + { + $transport = $this->createTransport(); + $client = $this->createClient(['transport' => $transport]); + + $this->assertTrue($transport->isExhausted()); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + + // Mock request + $formattedName = $client->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); + + try { + $client->listProductsInProductSet($formattedName); + // If the $client method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** + * @test + */ + public function importProductSetsTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/importProductSetsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new ImportProductSetsResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importProductSetsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + $inputConfig = new ImportProductSetsInputConfig(); + + $response = $client->importProductSets($formattedParent, $inputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.vision.v1.ProductSearch/ImportProductSets', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInputConfig(); + + $this->assertProtobufEquals($inputConfig, $actualValue); + + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importProductSetsTest'); + + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function importProductSetsExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/importProductSetsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + + // Mock request + $formattedParent = $client->locationName('[PROJECT]', '[LOCATION]'); + $inputConfig = new ImportProductSetsInputConfig(); + + $response = $client->importProductSets($formattedParent, $inputConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importProductSetsTest'); + + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/docs/contents/cloud-vision.json b/docs/contents/cloud-vision.json index 389fbcc78eee..f51f23b3188d 100644 --- a/docs/contents/cloud-vision.json +++ b/docs/contents/cloud-vision.json @@ -47,6 +47,9 @@ "nav": [{ "title": "ImageAnnotatorClient", "type": "vision/v1/imageannotatorclient" + }, { + "title": "ProductSearchClient", + "type": "vision/v1/productsearchclient" }] }] }