diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index e5f8c12aa5f..e4bf3c77361 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -1373,6 +1373,14 @@ "library_type": "GAPIC_AUTO", "api_shortname": "merchantapi" }, + "ShoppingMerchantReviews": { + "language": "php", + "distribution_name": "google/shopping-merchant-reviews", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/shopping-merchant-reviews/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "merchantapi" + }, "Spanner": { "language": "php", "distribution_name": "google/cloud-spanner", diff --git a/ShoppingMerchantReviews/.OwlBot.yaml b/ShoppingMerchantReviews/.OwlBot.yaml new file mode 100644 index 00000000000..843a231526a --- /dev/null +++ b/ShoppingMerchantReviews/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/shopping/merchant/reviews/(v1beta)/.*-php/(.*) + dest: /owl-bot-staging/ShoppingMerchantReviews/$1/$2 +api-name: ShoppingMerchantReviews diff --git a/ShoppingMerchantReviews/.gitattributes b/ShoppingMerchantReviews/.gitattributes new file mode 100644 index 00000000000..4bf0fe6f415 --- /dev/null +++ b/ShoppingMerchantReviews/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/ShoppingMerchantReviews/.github/pull_request_template.md b/ShoppingMerchantReviews/.github/pull_request_template.md new file mode 100644 index 00000000000..c7196903b1b --- /dev/null +++ b/ShoppingMerchantReviews/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `ShoppingMerchantReviews/src`, and tests in `ShoppingMerchantReviews/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/ShoppingMerchantReviews/CONTRIBUTING.md b/ShoppingMerchantReviews/CONTRIBUTING.md new file mode 100644 index 00000000000..76ea811cacd --- /dev/null +++ b/ShoppingMerchantReviews/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/ShoppingMerchantReviews/LICENSE b/ShoppingMerchantReviews/LICENSE new file mode 100644 index 00000000000..8f71f43fee3 --- /dev/null +++ b/ShoppingMerchantReviews/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/ShoppingMerchantReviews/README.md b/ShoppingMerchantReviews/README.md new file mode 100644 index 00000000000..759d56f5126 --- /dev/null +++ b/ShoppingMerchantReviews/README.md @@ -0,0 +1,50 @@ +# Google Shopping Merchant Reviews for PHP + +> Idiomatic PHP client for [Google Shopping Merchant Reviews](https://developers.google.com/merchant/api). + +[![Latest Stable Version](https://poser.pugx.org/google/shopping-merchant-reviews/v/stable)](https://packagist.org/packages/google/shopping-merchant-reviews) [![Packagist](https://img.shields.io/packagist/dm/google/shopping-merchant-reviews.svg)](https://packagist.org/packages/google/shopping-merchant-reviews) + +* [API documentation](https://cloud.google.com/php/docs/reference/shopping-merchant-reviews/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/shopping-merchant-reviews +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](https://github.com/googleapis/php-shopping-merchant-reviews/tree/main/samples) for a canonical list of samples. + +### Debugging + +Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) +for more information about the debugging tools. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://developers.google.com/merchant/api). diff --git a/ShoppingMerchantReviews/VERSION b/ShoppingMerchantReviews/VERSION new file mode 100644 index 00000000000..77d6f4ca237 --- /dev/null +++ b/ShoppingMerchantReviews/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/ShoppingMerchantReviews/composer.json b/ShoppingMerchantReviews/composer.json new file mode 100644 index 00000000000..c7dcaac72a1 --- /dev/null +++ b/ShoppingMerchantReviews/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/shopping-merchant-reviews", + "description": "Google Shopping Merchant Reviews Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Shopping\\Merchant\\Reviews\\": "src", + "GPBMetadata\\Google\\Shopping\\Merchant\\Reviews\\": "metadata" + } + }, + "extra": { + "component": { + "id": "shopping-merchant-reviews", + "path": "ShoppingMerchantReviews", + "target": "googleapis/php-shopping-merchant-reviews" + } + }, + "require": { + "php": "^8.0", + "google/gax": "^1.36.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/ShoppingMerchantReviews/metadata/V1Beta/Merchantreviews.php b/ShoppingMerchantReviews/metadata/V1Beta/Merchantreviews.php new file mode 100644 index 00000000000..4afe44d98a2 --- /dev/null +++ b/ShoppingMerchantReviews/metadata/V1Beta/Merchantreviews.php @@ -0,0 +1,67 @@ +internalAddGeneratedFile( + ' +Ë +=google/shopping/merchant/reviews/v1beta/merchantreviews.proto\'google.shopping.merchant.reviews.v1betagoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/empty.protoDgoogle/shopping/merchant/reviews/v1beta/merchantreviews_common.proto google/shopping/type/types.proto"[ +GetMerchantReviewRequest? +name ( B1àAúA+ +)merchantapi.googleapis.com/MerchantReview"^ +DeleteMerchantReviewRequest? +name ( B1àAúA+ +)merchantapi.googleapis.com/MerchantReview" +ListMerchantReviewsRequestA +parent ( B1àAúA+)merchantapi.googleapis.com/MerchantReview + page_size (BàA + +page_token ( BàA"£ +InsertMerchantReviewRequest +parent ( BàAU +merchant_review ( 27.google.shopping.merchant.reviews.v1beta.MerchantReviewBàA + data_source ( BàA"‰ +ListMerchantReviewsResponseQ +merchant_reviews ( 27.google.shopping.merchant.reviews.v1beta.MerchantReview +next_page_token ( "á +MerchantReview +name ( BàA +merchant_review_id ( BàAZ + +attributes ( 2A.google.shopping.merchant.reviews.v1beta.MerchantReviewAttributesBàAE +custom_attributes ( 2%.google.shopping.type.CustomAttributeBàA + data_source ( BàAb +merchant_review_status ( 2=.google.shopping.merchant.reviews.v1beta.MerchantReviewStatusBàA:zêAw +)merchantapi.googleapis.com/MerchantReview)accounts/{account}/merchantReviews/{name}*merchantReviews2merchantReview2È +MerchantReviewsServiceÓ +GetMerchantReviewA.google.shopping.merchant.reviews.v1beta.GetMerchantReviewRequest7.google.shopping.merchant.reviews.v1beta.MerchantReview"BÚAname‚Óä“53/reviews/v1beta/{name=accounts/*/merchantReviews/*}æ +ListMerchantReviewsC.google.shopping.merchant.reviews.v1beta.ListMerchantReviewsRequestD.google.shopping.merchant.reviews.v1beta.ListMerchantReviewsResponse"DÚAparent‚Óä“53/reviews/v1beta/{parent=accounts/*}/merchantReviewsê +InsertMerchantReviewD.google.shopping.merchant.reviews.v1beta.InsertMerchantReviewRequest7.google.shopping.merchant.reviews.v1beta.MerchantReview"S‚Óä“M":/reviews/v1beta/{parent=accounts/*}/merchantReviews:insert:merchant_review¸ +DeleteMerchantReviewD.google.shopping.merchant.reviews.v1beta.DeleteMerchantReviewRequest.google.protobuf.Empty"BÚAname‚Óä“5*3/reviews/v1beta/{name=accounts/*/merchantReviews/*}GÊAmerchantapi.googleapis.comÒA\'https://www.googleapis.com/auth/contentBÍ ++com.google.shopping.merchant.reviews.v1betaBMerchantReviewsProtoPZKcloud.google.com/go/shopping/merchant/reviews/apiv1beta/reviewspb;reviewspbêA8 +"merchantapi.googleapis.com/Accountaccounts/{account}bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/ShoppingMerchantReviews/metadata/V1Beta/MerchantreviewsCommon.php b/ShoppingMerchantReviews/metadata/V1Beta/MerchantreviewsCommon.php new file mode 100644 index 00000000000..dacd6194b61 Binary files /dev/null and b/ShoppingMerchantReviews/metadata/V1Beta/MerchantreviewsCommon.php differ diff --git a/ShoppingMerchantReviews/metadata/V1Beta/Productreviews.php b/ShoppingMerchantReviews/metadata/V1Beta/Productreviews.php new file mode 100644 index 00000000000..f75f186688f --- /dev/null +++ b/ShoppingMerchantReviews/metadata/V1Beta/Productreviews.php @@ -0,0 +1,66 @@ +internalAddGeneratedFile( + ' +ð + +name ( B0àAúA* +(merchantapi.googleapis.com/ProductReview"\\ +DeleteProductReviewRequest> +name ( B0àAúA* +(merchantapi.googleapis.com/ProductReview"Ž +ListProductReviewsRequest@ +parent ( B0àAúA*(merchantapi.googleapis.com/ProductReview + page_size (BàA + +page_token ( BàA"  +InsertProductReviewRequest +parent ( BàAS +product_review ( 26.google.shopping.merchant.reviews.v1beta.ProductReviewBàA + data_source ( BàA"† +ListProductReviewsResponseO +product_reviews ( 26.google.shopping.merchant.reviews.v1beta.ProductReview +next_page_token ( "á + ProductReview +name ( BàA +product_review_id ( BàAY + +attributes ( 2@.google.shopping.merchant.reviews.v1beta.ProductReviewAttributesBàAE +custom_attributes ( 2%.google.shopping.type.CustomAttributeBàA + data_source ( BàA` +product_review_status ( 2<.google.shopping.merchant.reviews.v1beta.ProductReviewStatusBàA:êA| +(merchantapi.googleapis.com/ProductReview1accounts/{account}/productReviews/{productreview}*productReviews2 productReview2· +ProductReviewsServiceÏ +GetProductReview@.google.shopping.merchant.reviews.v1beta.GetProductReviewRequest6.google.shopping.merchant.reviews.v1beta.ProductReview"AÚAname‚Óä“42/reviews/v1beta/{name=accounts/*/productReviews/*}â +ListProductReviewsB.google.shopping.merchant.reviews.v1beta.ListProductReviewsRequestC.google.shopping.merchant.reviews.v1beta.ListProductReviewsResponse"CÚAparent‚Óä“42/reviews/v1beta/{parent=accounts/*}/productReviewså +InsertProductReviewC.google.shopping.merchant.reviews.v1beta.InsertProductReviewRequest6.google.shopping.merchant.reviews.v1beta.ProductReview"Q‚Óä“K"9/reviews/v1beta/{parent=accounts/*}/productReviews:insert:product_reviewµ +DeleteProductReviewC.google.shopping.merchant.reviews.v1beta.DeleteProductReviewRequest.google.protobuf.Empty"AÚAname‚Óä“4*2/reviews/v1beta/{name=accounts/*/productReviews/*}GÊAmerchantapi.googleapis.comÒA\'https://www.googleapis.com/auth/contentB‘ ++com.google.shopping.merchant.reviews.v1betaBProductReviewsProtoPZKcloud.google.com/go/shopping/merchant/reviews/apiv1beta/reviewspb;reviewspbbproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/ShoppingMerchantReviews/metadata/V1Beta/ProductreviewsCommon.php b/ShoppingMerchantReviews/metadata/V1Beta/ProductreviewsCommon.php new file mode 100644 index 00000000000..6634ac2558a Binary files /dev/null and b/ShoppingMerchantReviews/metadata/V1Beta/ProductreviewsCommon.php differ diff --git a/ShoppingMerchantReviews/owlbot.py b/ShoppingMerchantReviews/owlbot.py new file mode 100644 index 00000000000..e92d7df10fa --- /dev/null +++ b/ShoppingMerchantReviews/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/ShoppingMerchantReviews").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main(src=src, dest=dest) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/ShoppingMerchantReviews/phpunit.xml.dist b/ShoppingMerchantReviews/phpunit.xml.dist new file mode 100644 index 00000000000..22d86e0d879 --- /dev/null +++ b/ShoppingMerchantReviews/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/delete_merchant_review.php b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/delete_merchant_review.php new file mode 100644 index 00000000000..eb6aa8e7dce --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/delete_merchant_review.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $merchantReviewsServiceClient->deleteMerchantReview($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MerchantReviewsServiceClient::merchantReviewName('[ACCOUNT]', '[NAME]'); + + delete_merchant_review_sample($formattedName); +} +// [END merchantapi_v1beta_generated_MerchantReviewsService_DeleteMerchantReview_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/get_merchant_review.php b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/get_merchant_review.php new file mode 100644 index 00000000000..7a685c3deb6 --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/get_merchant_review.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var MerchantReview $response */ + $response = $merchantReviewsServiceClient->getMerchantReview($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = MerchantReviewsServiceClient::merchantReviewName('[ACCOUNT]', '[NAME]'); + + get_merchant_review_sample($formattedName); +} +// [END merchantapi_v1beta_generated_MerchantReviewsService_GetMerchantReview_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/insert_merchant_review.php b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/insert_merchant_review.php new file mode 100644 index 00000000000..778f12fc3ed --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/insert_merchant_review.php @@ -0,0 +1,90 @@ +setMerchantReviewId($merchantReviewMerchantReviewId) + ->setCustomAttributes($merchantReviewCustomAttributes); + $request = (new InsertMerchantReviewRequest()) + ->setParent($parent) + ->setMerchantReview($merchantReview) + ->setDataSource($dataSource); + + // Call the API and handle any network failures. + try { + /** @var MerchantReview $response */ + $response = $merchantReviewsServiceClient->insertMerchantReview($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + $merchantReviewMerchantReviewId = '[MERCHANT_REVIEW_ID]'; + $dataSource = '[DATA_SOURCE]'; + + insert_merchant_review_sample($parent, $merchantReviewMerchantReviewId, $dataSource); +} +// [END merchantapi_v1beta_generated_MerchantReviewsService_InsertMerchantReview_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/list_merchant_reviews.php b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/list_merchant_reviews.php new file mode 100644 index 00000000000..825b4c3d975 --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/MerchantReviewsServiceClient/list_merchant_reviews.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $merchantReviewsServiceClient->listMerchantReviews($request); + + /** @var MerchantReview $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = MerchantReviewsServiceClient::accountName('[ACCOUNT]'); + + list_merchant_reviews_sample($formattedParent); +} +// [END merchantapi_v1beta_generated_MerchantReviewsService_ListMerchantReviews_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/delete_product_review.php b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/delete_product_review.php new file mode 100644 index 00000000000..46414a8cd0c --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/delete_product_review.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $productReviewsServiceClient->deleteProductReview($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductReviewsServiceClient::productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + + delete_product_review_sample($formattedName); +} +// [END merchantapi_v1beta_generated_ProductReviewsService_DeleteProductReview_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/get_product_review.php b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/get_product_review.php new file mode 100644 index 00000000000..730e74f6088 --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/get_product_review.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ProductReview $response */ + $response = $productReviewsServiceClient->getProductReview($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProductReviewsServiceClient::productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + + get_product_review_sample($formattedName); +} +// [END merchantapi_v1beta_generated_ProductReviewsService_GetProductReview_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/insert_product_review.php b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/insert_product_review.php new file mode 100644 index 00000000000..9db82575b22 --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/insert_product_review.php @@ -0,0 +1,84 @@ +setProductReviewId($productReviewProductReviewId); + $request = (new InsertProductReviewRequest()) + ->setParent($parent) + ->setProductReview($productReview) + ->setDataSource($dataSource); + + // Call the API and handle any network failures. + try { + /** @var ProductReview $response */ + $response = $productReviewsServiceClient->insertProductReview($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $parent = '[PARENT]'; + $productReviewProductReviewId = '[PRODUCT_REVIEW_ID]'; + $dataSource = '[DATA_SOURCE]'; + + insert_product_review_sample($parent, $productReviewProductReviewId, $dataSource); +} +// [END merchantapi_v1beta_generated_ProductReviewsService_InsertProductReview_sync] diff --git a/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/list_product_reviews.php b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/list_product_reviews.php new file mode 100644 index 00000000000..142a16544fd --- /dev/null +++ b/ShoppingMerchantReviews/samples/V1beta/ProductReviewsServiceClient/list_product_reviews.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $productReviewsServiceClient->listProductReviews($request); + + /** @var ProductReview $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ProductReviewsServiceClient::accountName('[ACCOUNT]'); + + list_product_reviews_sample($formattedParent); +} +// [END merchantapi_v1beta_generated_ProductReviewsService_ListProductReviews_sync] diff --git a/ShoppingMerchantReviews/src/V1beta/Client/MerchantReviewsServiceClient.php b/ShoppingMerchantReviews/src/V1beta/Client/MerchantReviewsServiceClient.php new file mode 100644 index 00000000000..0be6c76f641 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/Client/MerchantReviewsServiceClient.php @@ -0,0 +1,363 @@ + deleteMerchantReviewAsync(DeleteMerchantReviewRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMerchantReviewAsync(GetMerchantReviewRequest $request, array $optionalArgs = []) + * @method PromiseInterface insertMerchantReviewAsync(InsertMerchantReviewRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMerchantReviewsAsync(ListMerchantReviewsRequest $request, array $optionalArgs = []) + */ +final class MerchantReviewsServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.shopping.merchant.reviews.v1beta.MerchantReviewsService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'merchantapi.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'merchantapi.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = ['https://www.googleapis.com/auth/content']; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/merchant_reviews_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/merchant_reviews_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/merchant_reviews_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/merchant_reviews_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a account + * resource. + * + * @param string $account + * + * @return string The formatted account resource. + * + * @experimental + */ + public static function accountName(string $account): string + { + return self::getPathTemplate('account')->render([ + 'account' => $account, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * merchant_review resource. + * + * @param string $account + * @param string $name + * + * @return string The formatted merchant_review resource. + * + * @experimental + */ + public static function merchantReviewName(string $account, string $name): string + { + return self::getPathTemplate('merchantReview')->render([ + 'account' => $account, + 'name' => $name, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - account: accounts/{account} + * - merchantReview: accounts/{account}/merchantReviews/{name} + * + * 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(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'merchantapi.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 + * $apiEndpoint 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. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Deletes merchant review. + * + * The async variant is + * {@see MerchantReviewsServiceClient::deleteMerchantReviewAsync()} . + * + * @example samples/V1beta/MerchantReviewsServiceClient/delete_merchant_review.php + * + * @param DeleteMerchantReviewRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function deleteMerchantReview(DeleteMerchantReviewRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteMerchantReview', $request, $callOptions)->wait(); + } + + /** + * Gets a merchant review. + * + * The async variant is + * {@see MerchantReviewsServiceClient::getMerchantReviewAsync()} . + * + * @example samples/V1beta/MerchantReviewsServiceClient/get_merchant_review.php + * + * @param GetMerchantReviewRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MerchantReview + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getMerchantReview(GetMerchantReviewRequest $request, array $callOptions = []): MerchantReview + { + return $this->startApiCall('GetMerchantReview', $request, $callOptions)->wait(); + } + + /** + * Inserts a review for your Merchant Center account. If the review + * already exists, then the review is replaced with the new instance. + * + * The async variant is + * {@see MerchantReviewsServiceClient::insertMerchantReviewAsync()} . + * + * @example samples/V1beta/MerchantReviewsServiceClient/insert_merchant_review.php + * + * @param InsertMerchantReviewRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return MerchantReview + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function insertMerchantReview(InsertMerchantReviewRequest $request, array $callOptions = []): MerchantReview + { + return $this->startApiCall('InsertMerchantReview', $request, $callOptions)->wait(); + } + + /** + * Lists merchant reviews. + * + * The async variant is + * {@see MerchantReviewsServiceClient::listMerchantReviewsAsync()} . + * + * @example samples/V1beta/MerchantReviewsServiceClient/list_merchant_reviews.php + * + * @param ListMerchantReviewsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function listMerchantReviews(ListMerchantReviewsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMerchantReviews', $request, $callOptions); + } +} diff --git a/ShoppingMerchantReviews/src/V1beta/Client/ProductReviewsServiceClient.php b/ShoppingMerchantReviews/src/V1beta/Client/ProductReviewsServiceClient.php new file mode 100644 index 00000000000..80ff2097a4c --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/Client/ProductReviewsServiceClient.php @@ -0,0 +1,362 @@ + deleteProductReviewAsync(DeleteProductReviewRequest $request, array $optionalArgs = []) + * @method PromiseInterface getProductReviewAsync(GetProductReviewRequest $request, array $optionalArgs = []) + * @method PromiseInterface insertProductReviewAsync(InsertProductReviewRequest $request, array $optionalArgs = []) + * @method PromiseInterface listProductReviewsAsync(ListProductReviewsRequest $request, array $optionalArgs = []) + */ +final class ProductReviewsServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.shopping.merchant.reviews.v1beta.ProductReviewsService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'merchantapi.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'merchantapi.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = ['https://www.googleapis.com/auth/content']; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/product_reviews_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/product_reviews_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/product_reviews_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/product_reviews_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a account + * resource. + * + * @param string $account + * + * @return string The formatted account resource. + * + * @experimental + */ + public static function accountName(string $account): string + { + return self::getPathTemplate('account')->render([ + 'account' => $account, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * product_review resource. + * + * @param string $account + * @param string $productreview + * + * @return string The formatted product_review resource. + * + * @experimental + */ + public static function productReviewName(string $account, string $productreview): string + { + return self::getPathTemplate('productReview')->render([ + 'account' => $account, + 'productreview' => $productreview, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - account: accounts/{account} + * - productReview: accounts/{account}/productReviews/{productreview} + * + * 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(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'merchantapi.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 + * $apiEndpoint 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. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Deletes a product review. + * + * The async variant is + * {@see ProductReviewsServiceClient::deleteProductReviewAsync()} . + * + * @example samples/V1beta/ProductReviewsServiceClient/delete_product_review.php + * + * @param DeleteProductReviewRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function deleteProductReview(DeleteProductReviewRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteProductReview', $request, $callOptions)->wait(); + } + + /** + * Gets a product review. + * + * The async variant is {@see ProductReviewsServiceClient::getProductReviewAsync()} + * . + * + * @example samples/V1beta/ProductReviewsServiceClient/get_product_review.php + * + * @param GetProductReviewRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ProductReview + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getProductReview(GetProductReviewRequest $request, array $callOptions = []): ProductReview + { + return $this->startApiCall('GetProductReview', $request, $callOptions)->wait(); + } + + /** + * Inserts a product review. + * + * The async variant is + * {@see ProductReviewsServiceClient::insertProductReviewAsync()} . + * + * @example samples/V1beta/ProductReviewsServiceClient/insert_product_review.php + * + * @param InsertProductReviewRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ProductReview + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function insertProductReview(InsertProductReviewRequest $request, array $callOptions = []): ProductReview + { + return $this->startApiCall('InsertProductReview', $request, $callOptions)->wait(); + } + + /** + * Lists product reviews. + * + * The async variant is + * {@see ProductReviewsServiceClient::listProductReviewsAsync()} . + * + * @example samples/V1beta/ProductReviewsServiceClient/list_product_reviews.php + * + * @param ListProductReviewsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function listProductReviews(ListProductReviewsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProductReviews', $request, $callOptions); + } +} diff --git a/ShoppingMerchantReviews/src/V1beta/DeleteMerchantReviewRequest.php b/ShoppingMerchantReviews/src/V1beta/DeleteMerchantReviewRequest.php new file mode 100644 index 00000000000..f1cb5f32e0f --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/DeleteMerchantReviewRequest.php @@ -0,0 +1,86 @@ +google.shopping.merchant.reviews.v1beta.DeleteMerchantReviewRequest + */ +class DeleteMerchantReviewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * Please see {@see MerchantReviewsServiceClient::merchantReviewName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Reviews\V1beta\DeleteMerchantReviewRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Merchantreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/DeleteProductReviewRequest.php b/ShoppingMerchantReviews/src/V1beta/DeleteProductReviewRequest.php new file mode 100644 index 00000000000..68784f743d3 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/DeleteProductReviewRequest.php @@ -0,0 +1,86 @@ +google.shopping.merchant.reviews.v1beta.DeleteProductReviewRequest + */ +class DeleteProductReviewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ID of the Product review. + * Format: accounts/{account}/productReviews/{productReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The ID of the Product review. + * Format: accounts/{account}/productReviews/{productReview} + * Please see {@see ProductReviewsServiceClient::productReviewName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Reviews\V1beta\DeleteProductReviewRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ID of the Product review. + * Format: accounts/{account}/productReviews/{productReview} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Productreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ID of the Product review. + * Format: accounts/{account}/productReviews/{productReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ID of the Product review. + * Format: accounts/{account}/productReviews/{productReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/GetMerchantReviewRequest.php b/ShoppingMerchantReviews/src/V1beta/GetMerchantReviewRequest.php new file mode 100644 index 00000000000..fe49f63c300 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/GetMerchantReviewRequest.php @@ -0,0 +1,86 @@ +google.shopping.merchant.reviews.v1beta.GetMerchantReviewRequest + */ +class GetMerchantReviewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * Please see {@see MerchantReviewsServiceClient::merchantReviewName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Reviews\V1beta\GetMerchantReviewRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Merchantreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/merchantReviews/{merchantReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/GetProductReviewRequest.php b/ShoppingMerchantReviews/src/V1beta/GetProductReviewRequest.php new file mode 100644 index 00000000000..4b054cd5b7d --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/GetProductReviewRequest.php @@ -0,0 +1,86 @@ +google.shopping.merchant.reviews.v1beta.GetProductReviewRequest + */ +class GetProductReviewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/productReviews/{productReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The ID of the merchant review. + * Format: accounts/{account}/productReviews/{productReview} + * Please see {@see ProductReviewsServiceClient::productReviewName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Reviews\V1beta\GetProductReviewRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The ID of the merchant review. + * Format: accounts/{account}/productReviews/{productReview} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Productreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/productReviews/{productReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The ID of the merchant review. + * Format: accounts/{account}/productReviews/{productReview} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/InsertMerchantReviewRequest.php b/ShoppingMerchantReviews/src/V1beta/InsertMerchantReviewRequest.php new file mode 100644 index 00000000000..f00eb0f658f --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/InsertMerchantReviewRequest.php @@ -0,0 +1,161 @@ +google.shopping.merchant.reviews.v1beta.InsertMerchantReviewRequest + */ +class InsertMerchantReviewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The account where the merchant review will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * Required. The merchant review to insert. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReview merchant_review = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $merchant_review = null; + /** + * Required. The data source of the + * [merchantreview](https://support.google.com/merchants/answer/7045996?sjid=5253581244217581976-EU) + * Format: + * `accounts/{account}/dataSources/{datasource}`. + * + * Generated from protobuf field string data_source = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_source = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The account where the merchant review will be inserted. + * Format: accounts/{account} + * @type \Google\Shopping\Merchant\Reviews\V1beta\MerchantReview $merchant_review + * Required. The merchant review to insert. + * @type string $data_source + * Required. The data source of the + * [merchantreview](https://support.google.com/merchants/answer/7045996?sjid=5253581244217581976-EU) + * Format: + * `accounts/{account}/dataSources/{datasource}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Merchantreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The account where the merchant review will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The account where the merchant review will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The merchant review to insert. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReview merchant_review = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\MerchantReview|null + */ + public function getMerchantReview() + { + return $this->merchant_review; + } + + public function hasMerchantReview() + { + return isset($this->merchant_review); + } + + public function clearMerchantReview() + { + unset($this->merchant_review); + } + + /** + * Required. The merchant review to insert. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReview merchant_review = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\MerchantReview $var + * @return $this + */ + public function setMerchantReview($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReview::class); + $this->merchant_review = $var; + + return $this; + } + + /** + * Required. The data source of the + * [merchantreview](https://support.google.com/merchants/answer/7045996?sjid=5253581244217581976-EU) + * Format: + * `accounts/{account}/dataSources/{datasource}`. + * + * Generated from protobuf field string data_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDataSource() + { + return $this->data_source; + } + + /** + * Required. The data source of the + * [merchantreview](https://support.google.com/merchants/answer/7045996?sjid=5253581244217581976-EU) + * Format: + * `accounts/{account}/dataSources/{datasource}`. + * + * Generated from protobuf field string data_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDataSource($var) + { + GPBUtil::checkString($var, True); + $this->data_source = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/InsertProductReviewRequest.php b/ShoppingMerchantReviews/src/V1beta/InsertProductReviewRequest.php new file mode 100644 index 00000000000..0df4c4c9e93 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/InsertProductReviewRequest.php @@ -0,0 +1,153 @@ +google.shopping.merchant.reviews.v1beta.InsertProductReviewRequest + */ +class InsertProductReviewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The account where the product review will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $parent = ''; + /** + * Required. The product review to insert. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReview product_review = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $product_review = null; + /** + * Required. Format: + * `accounts/{account}/dataSources/{datasource}`. + * + * Generated from protobuf field string data_source = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_source = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The account where the product review will be inserted. + * Format: accounts/{account} + * @type \Google\Shopping\Merchant\Reviews\V1beta\ProductReview $product_review + * Required. The product review to insert. + * @type string $data_source + * Required. Format: + * `accounts/{account}/dataSources/{datasource}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Productreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The account where the product review will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The account where the product review will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The product review to insert. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReview product_review = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\ProductReview|null + */ + public function getProductReview() + { + return $this->product_review; + } + + public function hasProductReview() + { + return isset($this->product_review); + } + + public function clearProductReview() + { + unset($this->product_review); + } + + /** + * Required. The product review to insert. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReview product_review = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\ProductReview $var + * @return $this + */ + public function setProductReview($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReview::class); + $this->product_review = $var; + + return $this; + } + + /** + * Required. Format: + * `accounts/{account}/dataSources/{datasource}`. + * + * Generated from protobuf field string data_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDataSource() + { + return $this->data_source; + } + + /** + * Required. Format: + * `accounts/{account}/dataSources/{datasource}`. + * + * Generated from protobuf field string data_source = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDataSource($var) + { + GPBUtil::checkString($var, True); + $this->data_source = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/ListMerchantReviewsRequest.php b/ShoppingMerchantReviews/src/V1beta/ListMerchantReviewsRequest.php new file mode 100644 index 00000000000..226d81aac0e --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ListMerchantReviewsRequest.php @@ -0,0 +1,178 @@ +google.shopping.merchant.reviews.v1beta.ListMerchantReviewsRequest + */ +class ListMerchantReviewsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The account to list merchant reviews for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of merchant reviews to return. The service can + * return fewer than this value. The maximum value is 1000; values above 1000 + * are coerced to 1000. If unspecified, the maximum number of reviews is + * returned. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListMerchantReviews` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMerchantReviews` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The account to list merchant reviews for. + * Format: accounts/{account} + * Please see {@see MerchantReviewsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Reviews\V1beta\ListMerchantReviewsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The account to list merchant reviews for. + * Format: accounts/{account} + * @type int $page_size + * Optional. The maximum number of merchant reviews to return. The service can + * return fewer than this value. The maximum value is 1000; values above 1000 + * are coerced to 1000. If unspecified, the maximum number of reviews is + * returned. + * @type string $page_token + * Optional. A page token, received from a previous `ListMerchantReviews` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMerchantReviews` + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Merchantreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The account to list merchant reviews for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The account to list merchant reviews for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of merchant reviews to return. The service can + * return fewer than this value. The maximum value is 1000; values above 1000 + * are coerced to 1000. If unspecified, the maximum number of reviews is + * returned. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of merchant reviews to return. The service can + * return fewer than this value. The maximum value is 1000; values above 1000 + * are coerced to 1000. If unspecified, the maximum number of reviews is + * returned. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous `ListMerchantReviews` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMerchantReviews` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListMerchantReviews` + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListMerchantReviews` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/ListMerchantReviewsResponse.php b/ShoppingMerchantReviews/src/V1beta/ListMerchantReviewsResponse.php new file mode 100644 index 00000000000..dc9d6945fde --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ListMerchantReviewsResponse.php @@ -0,0 +1,101 @@ +google.shopping.merchant.reviews.v1beta.ListMerchantReviewsResponse + */ +class ListMerchantReviewsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReview merchant_reviews = 1; + */ + private $merchant_reviews; + /** + * The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Merchant\Reviews\V1beta\MerchantReview>|\Google\Protobuf\Internal\RepeatedField $merchant_reviews + * The merchant review. + * @type string $next_page_token + * The token to retrieve the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Merchantreviews::initOnce(); + parent::__construct($data); + } + + /** + * The merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReview merchant_reviews = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMerchantReviews() + { + return $this->merchant_reviews; + } + + /** + * The merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReview merchant_reviews = 1; + * @param array<\Google\Shopping\Merchant\Reviews\V1beta\MerchantReview>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMerchantReviews($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReview::class); + $this->merchant_reviews = $arr; + + return $this; + } + + /** + * The token to retrieve the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The token to retrieve the next page of results. + * + * 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/ShoppingMerchantReviews/src/V1beta/ListProductReviewsRequest.php b/ShoppingMerchantReviews/src/V1beta/ListProductReviewsRequest.php new file mode 100644 index 00000000000..06f50ac7118 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ListProductReviewsRequest.php @@ -0,0 +1,170 @@ +google.shopping.merchant.reviews.v1beta.ListProductReviewsRequest + */ +class ListProductReviewsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The account to list product reviews for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of products to return. The service may return + * fewer than this value. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListProductReviews` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProductReviews` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The account to list product reviews for. + * Format: accounts/{account} + * Please see {@see ProductReviewsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Merchant\Reviews\V1beta\ListProductReviewsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The account to list product reviews for. + * Format: accounts/{account} + * @type int $page_size + * Optional. The maximum number of products to return. The service may return + * fewer than this value. + * @type string $page_token + * Optional. A page token, received from a previous `ListProductReviews` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProductReviews` + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Productreviews::initOnce(); + parent::__construct($data); + } + + /** + * Required. The account to list product reviews for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The account to list product reviews for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of products to return. The service may return + * fewer than this value. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of products to return. The service may return + * fewer than this value. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous `ListProductReviews` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProductReviews` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListProductReviews` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListProductReviews` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/ListProductReviewsResponse.php b/ShoppingMerchantReviews/src/V1beta/ListProductReviewsResponse.php new file mode 100644 index 00000000000..5cb55c035e3 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ListProductReviewsResponse.php @@ -0,0 +1,105 @@ +google.shopping.merchant.reviews.v1beta.ListProductReviewsResponse + */ +class ListProductReviewsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReview product_reviews = 1; + */ + private $product_reviews; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Merchant\Reviews\V1beta\ProductReview>|\Google\Protobuf\Internal\RepeatedField $product_reviews + * The product review. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Productreviews::initOnce(); + parent::__construct($data); + } + + /** + * The product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReview product_reviews = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductReviews() + { + return $this->product_reviews; + } + + /** + * The product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReview product_reviews = 1; + * @param array<\Google\Shopping\Merchant\Reviews\V1beta\ProductReview>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductReviews($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Reviews\V1beta\ProductReview::class); + $this->product_reviews = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * 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/ShoppingMerchantReviews/src/V1beta/MerchantReview.php b/ShoppingMerchantReviews/src/V1beta/MerchantReview.php new file mode 100644 index 00000000000..3da0814bf15 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReview.php @@ -0,0 +1,315 @@ +google.shopping.merchant.reviews.v1beta.MerchantReview + */ +class MerchantReview extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of the merchant review. + * Format: + * `"{merchantreview.name=accounts/{account}/merchantReviews/{merchantReview}}"` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Required. The user provided merchant review ID to uniquely identify the + * merchant review. + * + * Generated from protobuf field string merchant_review_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $merchant_review_id = ''; + /** + * Optional. A list of merchant review attributes. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $attributes = null; + /** + * Required. A list of custom (merchant-provided) attributes. It can also be + * used for submitting any attribute of the data specification in its generic + * form (for example, + * `{ "name": "size type", "value": "regular" }`). + * This is useful for submitting attributes not explicitly exposed by the + * API, such as experimental attributes. + * Maximum allowed number of characters for each + * custom attribute is 10240 (represents sum of characters for name and + * value). Maximum 2500 custom attributes can be set per product, with total + * size of 102.4kB. Underscores in custom attribute names are replaced by + * spaces upon insertion. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $custom_attributes; + /** + * Output only. The primary data source of the merchant review. + * + * Generated from protobuf field string data_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $data_source = ''; + /** + * Output only. The status of a merchant review, data validation issues, that + * is, information about a merchant review computed asynchronously. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus merchant_review_status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $merchant_review_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of the merchant review. + * Format: + * `"{merchantreview.name=accounts/{account}/merchantReviews/{merchantReview}}"` + * @type string $merchant_review_id + * Required. The user provided merchant review ID to uniquely identify the + * merchant review. + * @type \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewAttributes $attributes + * Optional. A list of merchant review attributes. + * @type array<\Google\Shopping\Type\CustomAttribute>|\Google\Protobuf\Internal\RepeatedField $custom_attributes + * Required. A list of custom (merchant-provided) attributes. It can also be + * used for submitting any attribute of the data specification in its generic + * form (for example, + * `{ "name": "size type", "value": "regular" }`). + * This is useful for submitting attributes not explicitly exposed by the + * API, such as experimental attributes. + * Maximum allowed number of characters for each + * custom attribute is 10240 (represents sum of characters for name and + * value). Maximum 2500 custom attributes can be set per product, with total + * size of 102.4kB. Underscores in custom attribute names are replaced by + * spaces upon insertion. + * @type string $data_source + * Output only. The primary data source of the merchant review. + * @type \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus $merchant_review_status + * Output only. The status of a merchant review, data validation issues, that + * is, information about a merchant review computed asynchronously. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Merchantreviews::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of the merchant review. + * Format: + * `"{merchantreview.name=accounts/{account}/merchantReviews/{merchantReview}}"` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of the merchant review. + * Format: + * `"{merchantreview.name=accounts/{account}/merchantReviews/{merchantReview}}"` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The user provided merchant review ID to uniquely identify the + * merchant review. + * + * Generated from protobuf field string merchant_review_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMerchantReviewId() + { + return $this->merchant_review_id; + } + + /** + * Required. The user provided merchant review ID to uniquely identify the + * merchant review. + * + * Generated from protobuf field string merchant_review_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMerchantReviewId($var) + { + GPBUtil::checkString($var, True); + $this->merchant_review_id = $var; + + return $this; + } + + /** + * Optional. A list of merchant review attributes. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewAttributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * Optional. A list of merchant review attributes. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewAttributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewAttributes::class); + $this->attributes = $var; + + return $this; + } + + /** + * Required. A list of custom (merchant-provided) attributes. It can also be + * used for submitting any attribute of the data specification in its generic + * form (for example, + * `{ "name": "size type", "value": "regular" }`). + * This is useful for submitting attributes not explicitly exposed by the + * API, such as experimental attributes. + * Maximum allowed number of characters for each + * custom attribute is 10240 (represents sum of characters for name and + * value). Maximum 2500 custom attributes can be set per product, with total + * size of 102.4kB. Underscores in custom attribute names are replaced by + * spaces upon insertion. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCustomAttributes() + { + return $this->custom_attributes; + } + + /** + * Required. A list of custom (merchant-provided) attributes. It can also be + * used for submitting any attribute of the data specification in its generic + * form (for example, + * `{ "name": "size type", "value": "regular" }`). + * This is useful for submitting attributes not explicitly exposed by the + * API, such as experimental attributes. + * Maximum allowed number of characters for each + * custom attribute is 10240 (represents sum of characters for name and + * value). Maximum 2500 custom attributes can be set per product, with total + * size of 102.4kB. Underscores in custom attribute names are replaced by + * spaces upon insertion. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Shopping\Type\CustomAttribute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCustomAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Type\CustomAttribute::class); + $this->custom_attributes = $arr; + + return $this; + } + + /** + * Output only. The primary data source of the merchant review. + * + * Generated from protobuf field string data_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDataSource() + { + return $this->data_source; + } + + /** + * Output only. The primary data source of the merchant review. + * + * Generated from protobuf field string data_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDataSource($var) + { + GPBUtil::checkString($var, True); + $this->data_source = $var; + + return $this; + } + + /** + * Output only. The status of a merchant review, data validation issues, that + * is, information about a merchant review computed asynchronously. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus merchant_review_status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus|null + */ + public function getMerchantReviewStatus() + { + return $this->merchant_review_status; + } + + public function hasMerchantReviewStatus() + { + return isset($this->merchant_review_status); + } + + public function clearMerchantReviewStatus() + { + unset($this->merchant_review_status); + } + + /** + * Output only. The status of a merchant review, data validation issues, that + * is, information about a merchant review computed asynchronously. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus merchant_review_status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus $var + * @return $this + */ + public function setMerchantReviewStatus($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus::class); + $this->merchant_review_status = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/MerchantReviewAttributes.php b/ShoppingMerchantReviews/src/V1beta/MerchantReviewAttributes.php new file mode 100644 index 00000000000..3f9b48fa169 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReviewAttributes.php @@ -0,0 +1,789 @@ +google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes + */ +class MerchantReviewAttributes extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Must be unique and stable across all requests. In other words, if + * a request today and another 90 days ago refer to the same merchant, they + * must have the same id. + * + * Generated from protobuf field optional string merchant_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $merchant_id = null; + /** + * Optional. Human-readable display name for the merchant. + * + * Generated from protobuf field optional string merchant_display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $merchant_display_name = null; + /** + * Optional. URL to the merchant's main website. Do not use a redirect URL for + * this value. In other words, the value should point directly to the + * merchant's site. + * + * Generated from protobuf field optional string merchant_link = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $merchant_link = null; + /** + * Optional. URL to the landing page that hosts the reviews for this merchant. + * Do not use a redirect URL. + * + * Generated from protobuf field optional string merchant_rating_link = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $merchant_rating_link = null; + /** + * Optional. The minimum possible number for the rating. This should be the + * worst possible rating and should not be a value for no rating. + * + * Generated from protobuf field optional int64 min_rating = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $min_rating = null; + /** + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min rating. + * + * Generated from protobuf field optional int64 max_rating = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_rating = null; + /** + * Optional. The reviewer's overall rating of the merchant. + * + * Generated from protobuf field optional double rating = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rating = null; + /** + * Optional. The title of the review. + * + * Generated from protobuf field optional string title = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $title = null; + /** + * Required. This should be any freeform text provided by the user and should + * not be truncated. If multiple responses to different questions are + * provided, all responses should be included, with the minimal context for + * the responses to make sense. Context should not be provided if questions + * were left unanswered. + * + * Generated from protobuf field optional string content = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $content = null; + /** + * Optional. A permanent, unique identifier for the author of the review in + * the publisher's system. + * + * Generated from protobuf field optional string reviewer_id = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $reviewer_id = null; + /** + * Optional. Display name of the review author. + * + * Generated from protobuf field optional string reviewer_username = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $reviewer_username = null; + /** + * Optional. Set to true if the reviewer should remain anonymous. + * + * Generated from protobuf field optional bool is_anonymous = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $is_anonymous = null; + /** + * Optional. The method used to collect the review. + * + * Generated from protobuf field optional .google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes.CollectionMethod collection_method = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $collection_method = null; + /** + * Required. The timestamp indicating when the review was written. + * + * Generated from protobuf field optional .google.protobuf.Timestamp review_time = 14 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $review_time = null; + /** + * Required. The language of the review defined by BCP-47 language code. + * + * Generated from protobuf field optional string review_language = 15 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $review_language = null; + /** + * Optional. The country where the reviewer made the order defined by ISO + * 3166-1 Alpha-2 Country Code. + * + * Generated from protobuf field optional string review_country = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $review_country = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $merchant_id + * Required. Must be unique and stable across all requests. In other words, if + * a request today and another 90 days ago refer to the same merchant, they + * must have the same id. + * @type string $merchant_display_name + * Optional. Human-readable display name for the merchant. + * @type string $merchant_link + * Optional. URL to the merchant's main website. Do not use a redirect URL for + * this value. In other words, the value should point directly to the + * merchant's site. + * @type string $merchant_rating_link + * Optional. URL to the landing page that hosts the reviews for this merchant. + * Do not use a redirect URL. + * @type int|string $min_rating + * Optional. The minimum possible number for the rating. This should be the + * worst possible rating and should not be a value for no rating. + * @type int|string $max_rating + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min rating. + * @type float $rating + * Optional. The reviewer's overall rating of the merchant. + * @type string $title + * Optional. The title of the review. + * @type string $content + * Required. This should be any freeform text provided by the user and should + * not be truncated. If multiple responses to different questions are + * provided, all responses should be included, with the minimal context for + * the responses to make sense. Context should not be provided if questions + * were left unanswered. + * @type string $reviewer_id + * Optional. A permanent, unique identifier for the author of the review in + * the publisher's system. + * @type string $reviewer_username + * Optional. Display name of the review author. + * @type bool $is_anonymous + * Optional. Set to true if the reviewer should remain anonymous. + * @type int $collection_method + * Optional. The method used to collect the review. + * @type \Google\Protobuf\Timestamp $review_time + * Required. The timestamp indicating when the review was written. + * @type string $review_language + * Required. The language of the review defined by BCP-47 language code. + * @type string $review_country + * Optional. The country where the reviewer made the order defined by ISO + * 3166-1 Alpha-2 Country Code. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\MerchantreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Required. Must be unique and stable across all requests. In other words, if + * a request today and another 90 days ago refer to the same merchant, they + * must have the same id. + * + * Generated from protobuf field optional string merchant_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getMerchantId() + { + return isset($this->merchant_id) ? $this->merchant_id : ''; + } + + public function hasMerchantId() + { + return isset($this->merchant_id); + } + + public function clearMerchantId() + { + unset($this->merchant_id); + } + + /** + * Required. Must be unique and stable across all requests. In other words, if + * a request today and another 90 days ago refer to the same merchant, they + * must have the same id. + * + * Generated from protobuf field optional string merchant_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setMerchantId($var) + { + GPBUtil::checkString($var, True); + $this->merchant_id = $var; + + return $this; + } + + /** + * Optional. Human-readable display name for the merchant. + * + * Generated from protobuf field optional string merchant_display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMerchantDisplayName() + { + return isset($this->merchant_display_name) ? $this->merchant_display_name : ''; + } + + public function hasMerchantDisplayName() + { + return isset($this->merchant_display_name); + } + + public function clearMerchantDisplayName() + { + unset($this->merchant_display_name); + } + + /** + * Optional. Human-readable display name for the merchant. + * + * Generated from protobuf field optional string merchant_display_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMerchantDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->merchant_display_name = $var; + + return $this; + } + + /** + * Optional. URL to the merchant's main website. Do not use a redirect URL for + * this value. In other words, the value should point directly to the + * merchant's site. + * + * Generated from protobuf field optional string merchant_link = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMerchantLink() + { + return isset($this->merchant_link) ? $this->merchant_link : ''; + } + + public function hasMerchantLink() + { + return isset($this->merchant_link); + } + + public function clearMerchantLink() + { + unset($this->merchant_link); + } + + /** + * Optional. URL to the merchant's main website. Do not use a redirect URL for + * this value. In other words, the value should point directly to the + * merchant's site. + * + * Generated from protobuf field optional string merchant_link = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMerchantLink($var) + { + GPBUtil::checkString($var, True); + $this->merchant_link = $var; + + return $this; + } + + /** + * Optional. URL to the landing page that hosts the reviews for this merchant. + * Do not use a redirect URL. + * + * Generated from protobuf field optional string merchant_rating_link = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMerchantRatingLink() + { + return isset($this->merchant_rating_link) ? $this->merchant_rating_link : ''; + } + + public function hasMerchantRatingLink() + { + return isset($this->merchant_rating_link); + } + + public function clearMerchantRatingLink() + { + unset($this->merchant_rating_link); + } + + /** + * Optional. URL to the landing page that hosts the reviews for this merchant. + * Do not use a redirect URL. + * + * Generated from protobuf field optional string merchant_rating_link = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMerchantRatingLink($var) + { + GPBUtil::checkString($var, True); + $this->merchant_rating_link = $var; + + return $this; + } + + /** + * Optional. The minimum possible number for the rating. This should be the + * worst possible rating and should not be a value for no rating. + * + * Generated from protobuf field optional int64 min_rating = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMinRating() + { + return isset($this->min_rating) ? $this->min_rating : 0; + } + + public function hasMinRating() + { + return isset($this->min_rating); + } + + public function clearMinRating() + { + unset($this->min_rating); + } + + /** + * Optional. The minimum possible number for the rating. This should be the + * worst possible rating and should not be a value for no rating. + * + * Generated from protobuf field optional int64 min_rating = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMinRating($var) + { + GPBUtil::checkInt64($var); + $this->min_rating = $var; + + return $this; + } + + /** + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min rating. + * + * Generated from protobuf field optional int64 max_rating = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMaxRating() + { + return isset($this->max_rating) ? $this->max_rating : 0; + } + + public function hasMaxRating() + { + return isset($this->max_rating); + } + + public function clearMaxRating() + { + unset($this->max_rating); + } + + /** + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min rating. + * + * Generated from protobuf field optional int64 max_rating = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMaxRating($var) + { + GPBUtil::checkInt64($var); + $this->max_rating = $var; + + return $this; + } + + /** + * Optional. The reviewer's overall rating of the merchant. + * + * Generated from protobuf field optional double rating = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getRating() + { + return isset($this->rating) ? $this->rating : 0.0; + } + + public function hasRating() + { + return isset($this->rating); + } + + public function clearRating() + { + unset($this->rating); + } + + /** + * Optional. The reviewer's overall rating of the merchant. + * + * Generated from protobuf field optional double rating = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setRating($var) + { + GPBUtil::checkDouble($var); + $this->rating = $var; + + return $this; + } + + /** + * Optional. The title of the review. + * + * Generated from protobuf field optional string title = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getTitle() + { + return isset($this->title) ? $this->title : ''; + } + + public function hasTitle() + { + return isset($this->title); + } + + public function clearTitle() + { + unset($this->title); + } + + /** + * Optional. The title of the review. + * + * Generated from protobuf field optional string title = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * Required. This should be any freeform text provided by the user and should + * not be truncated. If multiple responses to different questions are + * provided, all responses should be included, with the minimal context for + * the responses to make sense. Context should not be provided if questions + * were left unanswered. + * + * Generated from protobuf field optional string content = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getContent() + { + return isset($this->content) ? $this->content : ''; + } + + public function hasContent() + { + return isset($this->content); + } + + public function clearContent() + { + unset($this->content); + } + + /** + * Required. This should be any freeform text provided by the user and should + * not be truncated. If multiple responses to different questions are + * provided, all responses should be included, with the minimal context for + * the responses to make sense. Context should not be provided if questions + * were left unanswered. + * + * Generated from protobuf field optional string content = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * Optional. A permanent, unique identifier for the author of the review in + * the publisher's system. + * + * Generated from protobuf field optional string reviewer_id = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewerId() + { + return isset($this->reviewer_id) ? $this->reviewer_id : ''; + } + + public function hasReviewerId() + { + return isset($this->reviewer_id); + } + + public function clearReviewerId() + { + unset($this->reviewer_id); + } + + /** + * Optional. A permanent, unique identifier for the author of the review in + * the publisher's system. + * + * Generated from protobuf field optional string reviewer_id = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewerId($var) + { + GPBUtil::checkString($var, True); + $this->reviewer_id = $var; + + return $this; + } + + /** + * Optional. Display name of the review author. + * + * Generated from protobuf field optional string reviewer_username = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewerUsername() + { + return isset($this->reviewer_username) ? $this->reviewer_username : ''; + } + + public function hasReviewerUsername() + { + return isset($this->reviewer_username); + } + + public function clearReviewerUsername() + { + unset($this->reviewer_username); + } + + /** + * Optional. Display name of the review author. + * + * Generated from protobuf field optional string reviewer_username = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewerUsername($var) + { + GPBUtil::checkString($var, True); + $this->reviewer_username = $var; + + return $this; + } + + /** + * Optional. Set to true if the reviewer should remain anonymous. + * + * Generated from protobuf field optional bool is_anonymous = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIsAnonymous() + { + return isset($this->is_anonymous) ? $this->is_anonymous : false; + } + + public function hasIsAnonymous() + { + return isset($this->is_anonymous); + } + + public function clearIsAnonymous() + { + unset($this->is_anonymous); + } + + /** + * Optional. Set to true if the reviewer should remain anonymous. + * + * Generated from protobuf field optional bool is_anonymous = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIsAnonymous($var) + { + GPBUtil::checkBool($var); + $this->is_anonymous = $var; + + return $this; + } + + /** + * Optional. The method used to collect the review. + * + * Generated from protobuf field optional .google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes.CollectionMethod collection_method = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCollectionMethod() + { + return isset($this->collection_method) ? $this->collection_method : 0; + } + + public function hasCollectionMethod() + { + return isset($this->collection_method); + } + + public function clearCollectionMethod() + { + unset($this->collection_method); + } + + /** + * Optional. The method used to collect the review. + * + * Generated from protobuf field optional .google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes.CollectionMethod collection_method = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCollectionMethod($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewAttributes\CollectionMethod::class); + $this->collection_method = $var; + + return $this; + } + + /** + * Required. The timestamp indicating when the review was written. + * + * Generated from protobuf field optional .google.protobuf.Timestamp review_time = 14 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getReviewTime() + { + return $this->review_time; + } + + public function hasReviewTime() + { + return isset($this->review_time); + } + + public function clearReviewTime() + { + unset($this->review_time); + } + + /** + * Required. The timestamp indicating when the review was written. + * + * Generated from protobuf field optional .google.protobuf.Timestamp review_time = 14 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReviewTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->review_time = $var; + + return $this; + } + + /** + * Required. The language of the review defined by BCP-47 language code. + * + * Generated from protobuf field optional string review_language = 15 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getReviewLanguage() + { + return isset($this->review_language) ? $this->review_language : ''; + } + + public function hasReviewLanguage() + { + return isset($this->review_language); + } + + public function clearReviewLanguage() + { + unset($this->review_language); + } + + /** + * Required. The language of the review defined by BCP-47 language code. + * + * Generated from protobuf field optional string review_language = 15 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setReviewLanguage($var) + { + GPBUtil::checkString($var, True); + $this->review_language = $var; + + return $this; + } + + /** + * Optional. The country where the reviewer made the order defined by ISO + * 3166-1 Alpha-2 Country Code. + * + * Generated from protobuf field optional string review_country = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewCountry() + { + return isset($this->review_country) ? $this->review_country : ''; + } + + public function hasReviewCountry() + { + return isset($this->review_country); + } + + public function clearReviewCountry() + { + unset($this->review_country); + } + + /** + * Optional. The country where the reviewer made the order defined by ISO + * 3166-1 Alpha-2 Country Code. + * + * Generated from protobuf field optional string review_country = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewCountry($var) + { + GPBUtil::checkString($var, True); + $this->review_country = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/MerchantReviewAttributes/CollectionMethod.php b/ShoppingMerchantReviews/src/V1beta/MerchantReviewAttributes/CollectionMethod.php new file mode 100644 index 00000000000..b115056c000 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReviewAttributes/CollectionMethod.php @@ -0,0 +1,72 @@ +google.shopping.merchant.reviews.v1beta.MerchantReviewAttributes.CollectionMethod + */ +class CollectionMethod +{ + /** + * Collection method unspecified. + * + * Generated from protobuf enum COLLECTION_METHOD_UNSPECIFIED = 0; + */ + const COLLECTION_METHOD_UNSPECIFIED = 0; + /** + * The user was not responding to a specific solicitation when they + * submitted the review. + * + * Generated from protobuf enum MERCHANT_UNSOLICITED = 1; + */ + const MERCHANT_UNSOLICITED = 1; + /** + * The user submitted the review in response to a solicitation when the + * user placed an order. + * + * Generated from protobuf enum POINT_OF_SALE = 2; + */ + const POINT_OF_SALE = 2; + /** + * The user submitted the review in response to a solicitation after + * fulfillment of the user's order. + * + * Generated from protobuf enum AFTER_FULFILLMENT = 3; + */ + const AFTER_FULFILLMENT = 3; + + private static $valueToName = [ + self::COLLECTION_METHOD_UNSPECIFIED => 'COLLECTION_METHOD_UNSPECIFIED', + self::MERCHANT_UNSOLICITED => 'MERCHANT_UNSOLICITED', + self::POINT_OF_SALE => 'POINT_OF_SALE', + self::AFTER_FULFILLMENT => 'AFTER_FULFILLMENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus.php b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus.php new file mode 100644 index 00000000000..5656c463e39 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus.php @@ -0,0 +1,198 @@ +google.shopping.merchant.reviews.v1beta.MerchantReviewStatus + */ +class MerchantReviewStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The intended destinations for the merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewDestinationStatus destination_statuses = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $destination_statuses; + /** + * Output only. A list of all issues associated with the merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue item_level_issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $item_level_issues; + /** + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $last_update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewDestinationStatus>|\Google\Protobuf\Internal\RepeatedField $destination_statuses + * Output only. The intended destinations for the merchant review. + * @type array<\Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewItemLevelIssue>|\Google\Protobuf\Internal\RepeatedField $item_level_issues + * Output only. A list of all issues associated with the merchant review. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * @type \Google\Protobuf\Timestamp $last_update_time + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\MerchantreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The intended destinations for the merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewDestinationStatus destination_statuses = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinationStatuses() + { + return $this->destination_statuses; + } + + /** + * Output only. The intended destinations for the merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewDestinationStatus destination_statuses = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewDestinationStatus>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinationStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewDestinationStatus::class); + $this->destination_statuses = $arr; + + return $this; + } + + /** + * Output only. A list of all issues associated with the merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue item_level_issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItemLevelIssues() + { + return $this->item_level_issues; + } + + /** + * Output only. A list of all issues associated with the merchant review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue item_level_issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewItemLevelIssue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItemLevelIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewItemLevelIssue::class); + $this->item_level_issues = $arr; + + return $this; + } + + /** + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateTime() + { + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + unset($this->last_update_time); + } + + /** + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewDestinationStatus.php b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewDestinationStatus.php new file mode 100644 index 00000000000..2b43f7ebfd3 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewDestinationStatus.php @@ -0,0 +1,68 @@ +google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewDestinationStatus + */ +class MerchantReviewDestinationStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the reporting context. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reporting_context = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $reporting_context + * Output only. The name of the reporting context. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\MerchantreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the reporting context. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getReportingContext() + { + return $this->reporting_context; + } + + /** + * Output only. The name of the reporting context. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setReportingContext($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Type\ReportingContext\ReportingContextEnum::class); + $this->reporting_context = $var; + + return $this; + } + +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewItemLevelIssue.php b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewItemLevelIssue.php new file mode 100644 index 00000000000..838be1d759f --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewItemLevelIssue.php @@ -0,0 +1,310 @@ +google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue + */ +class MerchantReviewItemLevelIssue extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The error code of the issue. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $code = ''; + /** + * Output only. How this issue affects serving of the merchant review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue.Severity severity = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $severity = 0; + /** + * Output only. Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resolution = ''; + /** + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * + * Generated from protobuf field string attribute = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $attribute = ''; + /** + * Output only. The reporting context the issue applies to. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reporting_context = 0; + /** + * Output only. A short issue description in English. + * + * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $description = ''; + /** + * Output only. A detailed issue description in English. + * + * Generated from protobuf field string detail = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $detail = ''; + /** + * Output only. The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $documentation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $code + * Output only. The error code of the issue. + * @type int $severity + * Output only. How this issue affects serving of the merchant review. + * @type string $resolution + * Output only. Whether the issue can be resolved by the merchant. + * @type string $attribute + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * @type int $reporting_context + * Output only. The reporting context the issue applies to. + * @type string $description + * Output only. A short issue description in English. + * @type string $detail + * Output only. A detailed issue description in English. + * @type string $documentation + * Output only. The URL of a web page to help with resolving this issue. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\MerchantreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The error code of the issue. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. The error code of the issue. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + + /** + * Output only. How this issue affects serving of the merchant review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue.Severity severity = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Output only. How this issue affects serving of the merchant review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue.Severity severity = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Reviews\V1beta\MerchantReviewStatus\MerchantReviewItemLevelIssue\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Output only. Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getResolution() + { + return $this->resolution; + } + + /** + * Output only. Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setResolution($var) + { + GPBUtil::checkString($var, True); + $this->resolution = $var; + + return $this; + } + + /** + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * + * Generated from protobuf field string attribute = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * + * Generated from protobuf field string attribute = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAttribute($var) + { + GPBUtil::checkString($var, True); + $this->attribute = $var; + + return $this; + } + + /** + * Output only. The reporting context the issue applies to. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getReportingContext() + { + return $this->reporting_context; + } + + /** + * Output only. The reporting context the issue applies to. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setReportingContext($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Type\ReportingContext\ReportingContextEnum::class); + $this->reporting_context = $var; + + return $this; + } + + /** + * Output only. A short issue description in English. + * + * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Output only. A short issue description in English. + * + * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. A detailed issue description in English. + * + * Generated from protobuf field string detail = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDetail() + { + return $this->detail; + } + + /** + * Output only. A detailed issue description in English. + * + * Generated from protobuf field string detail = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDetail($var) + { + GPBUtil::checkString($var, True); + $this->detail = $var; + + return $this; + } + + /** + * Output only. The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDocumentation() + { + return $this->documentation; + } + + /** + * Output only. The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDocumentation($var) + { + GPBUtil::checkString($var, True); + $this->documentation = $var; + + return $this; + } + +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewItemLevelIssue/Severity.php b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewItemLevelIssue/Severity.php new file mode 100644 index 00000000000..48e223218e5 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/MerchantReviewStatus/MerchantReviewItemLevelIssue/Severity.php @@ -0,0 +1,63 @@ +google.shopping.merchant.reviews.v1beta.MerchantReviewStatus.MerchantReviewItemLevelIssue.Severity + */ +class Severity +{ + /** + * Not specified. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * This issue represents a warning and does not have a direct affect + * on the merchant review. + * + * Generated from protobuf enum NOT_IMPACTED = 1; + */ + const NOT_IMPACTED = 1; + /** + * Issue disapproves the merchant review. + * + * Generated from protobuf enum DISAPPROVED = 2; + */ + const DISAPPROVED = 2; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::NOT_IMPACTED => 'NOT_IMPACTED', + self::DISAPPROVED => 'DISAPPROVED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReview.php b/ShoppingMerchantReviews/src/V1beta/ProductReview.php new file mode 100644 index 00000000000..e4e0a4f07f0 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReview.php @@ -0,0 +1,275 @@ +google.shopping.merchant.reviews.v1beta.ProductReview + */ +class ProductReview extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of the product review. + * Format: + * `"{productreview.name=accounts/{account}/productReviews/{productReview}}"` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Required. The permanent, unique identifier for the product review in the + * publisher’s system. + * + * Generated from protobuf field string product_review_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $product_review_id = ''; + /** + * Optional. A list of product review attributes. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $attributes = null; + /** + * Optional. A list of custom (merchant-provided) attributes. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $custom_attributes; + /** + * Output only. The primary data source of the product review. + * + * Generated from protobuf field string data_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $data_source = ''; + /** + * Output only. The status of a product review, data validation issues, that + * is, information about a product review computed asynchronously. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewStatus product_review_status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $product_review_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of the product review. + * Format: + * `"{productreview.name=accounts/{account}/productReviews/{productReview}}"` + * @type string $product_review_id + * Required. The permanent, unique identifier for the product review in the + * publisher’s system. + * @type \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes $attributes + * Optional. A list of product review attributes. + * @type array<\Google\Shopping\Type\CustomAttribute>|\Google\Protobuf\Internal\RepeatedField $custom_attributes + * Optional. A list of custom (merchant-provided) attributes. + * @type string $data_source + * Output only. The primary data source of the product review. + * @type \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus $product_review_status + * Output only. The status of a product review, data validation issues, that + * is, information about a product review computed asynchronously. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\Productreviews::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of the product review. + * Format: + * `"{productreview.name=accounts/{account}/productReviews/{productReview}}"` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of the product review. + * Format: + * `"{productreview.name=accounts/{account}/productReviews/{productReview}}"` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The permanent, unique identifier for the product review in the + * publisher’s system. + * + * Generated from protobuf field string product_review_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getProductReviewId() + { + return $this->product_review_id; + } + + /** + * Required. The permanent, unique identifier for the product review in the + * publisher’s system. + * + * Generated from protobuf field string product_review_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setProductReviewId($var) + { + GPBUtil::checkString($var, True); + $this->product_review_id = $var; + + return $this; + } + + /** + * Optional. A list of product review attributes. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * Optional. A list of product review attributes. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes attributes = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes::class); + $this->attributes = $var; + + return $this; + } + + /** + * Optional. A list of custom (merchant-provided) attributes. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCustomAttributes() + { + return $this->custom_attributes; + } + + /** + * Optional. A list of custom (merchant-provided) attributes. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Shopping\Type\CustomAttribute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCustomAttributes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Type\CustomAttribute::class); + $this->custom_attributes = $arr; + + return $this; + } + + /** + * Output only. The primary data source of the product review. + * + * Generated from protobuf field string data_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDataSource() + { + return $this->data_source; + } + + /** + * Output only. The primary data source of the product review. + * + * Generated from protobuf field string data_source = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDataSource($var) + { + GPBUtil::checkString($var, True); + $this->data_source = $var; + + return $this; + } + + /** + * Output only. The status of a product review, data validation issues, that + * is, information about a product review computed asynchronously. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewStatus product_review_status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus|null + */ + public function getProductReviewStatus() + { + return $this->product_review_status; + } + + public function hasProductReviewStatus() + { + return isset($this->product_review_status); + } + + public function clearProductReviewStatus() + { + unset($this->product_review_status); + } + + /** + * Output only. The status of a product review, data validation issues, that + * is, information about a product review computed asynchronously. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewStatus product_review_status = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus $var + * @return $this + */ + public function setProductReviewStatus($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus::class); + $this->product_review_status = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes.php new file mode 100644 index 00000000000..3d54149fc49 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes.php @@ -0,0 +1,1305 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewAttributes + */ +class ProductReviewAttributes extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The name of the aggregator of the product reviews. + * A publisher may use a reviews aggregator to manage reviews and provide + * the feeds. This element indicates the use of an aggregator and contains + * information about the aggregator. + * + * Generated from protobuf field optional string aggregator_name = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $aggregator_name = null; + /** + * Optional. The name of the subclient of the product reviews. + * The subclient is an identifier of the product review source. + * It should be equivalent to the directory provided in the file data source + * path. + * + * Generated from protobuf field optional string subclient_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $subclient_name = null; + /** + * Optional. The name of the publisher of the product reviews. + * The information about the publisher, which may be a retailer, + * manufacturer, reviews service company, or any entity that publishes + * product reviews. + * + * Generated from protobuf field optional string publisher_name = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $publisher_name = null; + /** + * Optional. A link to the company favicon of the publisher. The image + * dimensions should be favicon size: 16x16 pixels. The image format should be + * GIF, JPG or PNG. + * + * Generated from protobuf field optional string publisher_favicon = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $publisher_favicon = null; + /** + * Optional. The author of the product review. + * A permanent, unique identifier for the author of the review in the + * publisher's system. + * + * Generated from protobuf field optional string reviewer_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $reviewer_id = null; + /** + * Optional. Set to true if the reviewer should remain anonymous. + * + * Generated from protobuf field optional bool reviewer_is_anonymous = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $reviewer_is_anonymous = null; + /** + * Optional. The name of the reviewer of the product review. + * + * Generated from protobuf field optional string reviewer_username = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $reviewer_username = null; + /** + * Optional. The language of the review defined by BCP-47 language code. + * + * Generated from protobuf field optional string review_language = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $review_language = null; + /** + * Optional. The country of the review defined by ISO 3166-1 Alpha-2 Country + * Code. + * + * Generated from protobuf field optional string review_country = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $review_country = null; + /** + * Required. The timestamp indicating when the review was written. + * + * Generated from protobuf field .google.protobuf.Timestamp review_time = 10 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $review_time = null; + /** + * Optional. The title of the review. + * + * Generated from protobuf field optional string title = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $title = null; + /** + * Required. The content of the review. + * + * Generated from protobuf field optional string content = 12 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $content = null; + /** + * Optional. Contains the advantages based on the opinion of the reviewer. + * Omit boilerplate text like "pro:" unless it was written by the reviewer. + * + * Generated from protobuf field repeated string pros = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $pros; + /** + * Optional. Contains the disadvantages based on the opinion of the reviewer. + * Omit boilerplate text like "con:" unless it was written by the reviewer. + * + * Generated from protobuf field repeated string cons = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $cons; + /** + * Optional. The URI of the review landing page. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink review_link = 15 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $review_link = null; + /** + * Optional. A URI to an image of the reviewed product created by the review + * author. The URI does not have to end with an image file extension. + * + * Generated from protobuf field repeated string reviewer_image_links = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $reviewer_image_links; + /** + * Optional. Contains the ratings associated with the review. + * The minimum possible number for the rating. This should be the worst + * possible rating and should not be a value for no rating. + * + * Generated from protobuf field optional int64 min_rating = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $min_rating = null; + /** + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min attribute. + * + * Generated from protobuf field optional int64 max_rating = 18 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_rating = null; + /** + * Optional. The reviewer's overall rating of the product. + * + * Generated from protobuf field optional double rating = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rating = null; + /** + * Optional. Descriptive name of a product. + * + * Generated from protobuf field repeated string product_names = 20 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $product_names; + /** + * Optional. The URI of the product. This URI can have the same value as the + * `review_link` element, if the review URI and the product URI are the + * same. + * + * Generated from protobuf field repeated string product_links = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $product_links; + /** + * Optional. Contains ASINs (Amazon Standard Identification Numbers) + * associated with a product. + * + * Generated from protobuf field repeated string asins = 22 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $asins; + /** + * Optional. Contains GTINs (global trade item numbers) associated with a + * product. Sub-types of GTINs (e.g. UPC, EAN, ISBN, JAN) are supported. + * + * Generated from protobuf field repeated string gtins = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $gtins; + /** + * Optional. Contains MPNs (manufacturer part numbers) associated with a + * product. + * + * Generated from protobuf field repeated string mpns = 24 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $mpns; + /** + * Optional. Contains SKUs (stock keeping units) associated with a product. + * Often this matches the product Offer Id in the product feed. + * + * Generated from protobuf field repeated string skus = 25 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $skus; + /** + * Optional. Contains brand names associated with a product. + * + * Generated from protobuf field repeated string brands = 26 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $brands; + /** + * Optional. Indicates whether the review is marked as spam in the publisher's + * system. + * + * Generated from protobuf field optional bool is_spam = 27 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $is_spam = null; + /** + * Optional. The method used to collect the review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.CollectionMethod collection_method = 28 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $collection_method = 0; + /** + * Optional. A permanent, unique identifier for the transaction associated + * with the review in the publisher's system. This ID can be used to indicate + * that multiple reviews are associated with the same transaction. + * + * Generated from protobuf field string transaction_id = 29 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $transaction_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $aggregator_name + * Optional. The name of the aggregator of the product reviews. + * A publisher may use a reviews aggregator to manage reviews and provide + * the feeds. This element indicates the use of an aggregator and contains + * information about the aggregator. + * @type string $subclient_name + * Optional. The name of the subclient of the product reviews. + * The subclient is an identifier of the product review source. + * It should be equivalent to the directory provided in the file data source + * path. + * @type string $publisher_name + * Optional. The name of the publisher of the product reviews. + * The information about the publisher, which may be a retailer, + * manufacturer, reviews service company, or any entity that publishes + * product reviews. + * @type string $publisher_favicon + * Optional. A link to the company favicon of the publisher. The image + * dimensions should be favicon size: 16x16 pixels. The image format should be + * GIF, JPG or PNG. + * @type string $reviewer_id + * Optional. The author of the product review. + * A permanent, unique identifier for the author of the review in the + * publisher's system. + * @type bool $reviewer_is_anonymous + * Optional. Set to true if the reviewer should remain anonymous. + * @type string $reviewer_username + * Optional. The name of the reviewer of the product review. + * @type string $review_language + * Optional. The language of the review defined by BCP-47 language code. + * @type string $review_country + * Optional. The country of the review defined by ISO 3166-1 Alpha-2 Country + * Code. + * @type \Google\Protobuf\Timestamp $review_time + * Required. The timestamp indicating when the review was written. + * @type string $title + * Optional. The title of the review. + * @type string $content + * Required. The content of the review. + * @type array|\Google\Protobuf\Internal\RepeatedField $pros + * Optional. Contains the advantages based on the opinion of the reviewer. + * Omit boilerplate text like "pro:" unless it was written by the reviewer. + * @type array|\Google\Protobuf\Internal\RepeatedField $cons + * Optional. Contains the disadvantages based on the opinion of the reviewer. + * Omit boilerplate text like "con:" unless it was written by the reviewer. + * @type \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes\ReviewLink $review_link + * Optional. The URI of the review landing page. + * @type array|\Google\Protobuf\Internal\RepeatedField $reviewer_image_links + * Optional. A URI to an image of the reviewed product created by the review + * author. The URI does not have to end with an image file extension. + * @type int|string $min_rating + * Optional. Contains the ratings associated with the review. + * The minimum possible number for the rating. This should be the worst + * possible rating and should not be a value for no rating. + * @type int|string $max_rating + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min attribute. + * @type float $rating + * Optional. The reviewer's overall rating of the product. + * @type array|\Google\Protobuf\Internal\RepeatedField $product_names + * Optional. Descriptive name of a product. + * @type array|\Google\Protobuf\Internal\RepeatedField $product_links + * Optional. The URI of the product. This URI can have the same value as the + * `review_link` element, if the review URI and the product URI are the + * same. + * @type array|\Google\Protobuf\Internal\RepeatedField $asins + * Optional. Contains ASINs (Amazon Standard Identification Numbers) + * associated with a product. + * @type array|\Google\Protobuf\Internal\RepeatedField $gtins + * Optional. Contains GTINs (global trade item numbers) associated with a + * product. Sub-types of GTINs (e.g. UPC, EAN, ISBN, JAN) are supported. + * @type array|\Google\Protobuf\Internal\RepeatedField $mpns + * Optional. Contains MPNs (manufacturer part numbers) associated with a + * product. + * @type array|\Google\Protobuf\Internal\RepeatedField $skus + * Optional. Contains SKUs (stock keeping units) associated with a product. + * Often this matches the product Offer Id in the product feed. + * @type array|\Google\Protobuf\Internal\RepeatedField $brands + * Optional. Contains brand names associated with a product. + * @type bool $is_spam + * Optional. Indicates whether the review is marked as spam in the publisher's + * system. + * @type int $collection_method + * Optional. The method used to collect the review. + * @type string $transaction_id + * Optional. A permanent, unique identifier for the transaction associated + * with the review in the publisher's system. This ID can be used to indicate + * that multiple reviews are associated with the same transaction. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\ProductreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The name of the aggregator of the product reviews. + * A publisher may use a reviews aggregator to manage reviews and provide + * the feeds. This element indicates the use of an aggregator and contains + * information about the aggregator. + * + * Generated from protobuf field optional string aggregator_name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAggregatorName() + { + return isset($this->aggregator_name) ? $this->aggregator_name : ''; + } + + public function hasAggregatorName() + { + return isset($this->aggregator_name); + } + + public function clearAggregatorName() + { + unset($this->aggregator_name); + } + + /** + * Optional. The name of the aggregator of the product reviews. + * A publisher may use a reviews aggregator to manage reviews and provide + * the feeds. This element indicates the use of an aggregator and contains + * information about the aggregator. + * + * Generated from protobuf field optional string aggregator_name = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAggregatorName($var) + { + GPBUtil::checkString($var, True); + $this->aggregator_name = $var; + + return $this; + } + + /** + * Optional. The name of the subclient of the product reviews. + * The subclient is an identifier of the product review source. + * It should be equivalent to the directory provided in the file data source + * path. + * + * Generated from protobuf field optional string subclient_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getSubclientName() + { + return isset($this->subclient_name) ? $this->subclient_name : ''; + } + + public function hasSubclientName() + { + return isset($this->subclient_name); + } + + public function clearSubclientName() + { + unset($this->subclient_name); + } + + /** + * Optional. The name of the subclient of the product reviews. + * The subclient is an identifier of the product review source. + * It should be equivalent to the directory provided in the file data source + * path. + * + * Generated from protobuf field optional string subclient_name = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setSubclientName($var) + { + GPBUtil::checkString($var, True); + $this->subclient_name = $var; + + return $this; + } + + /** + * Optional. The name of the publisher of the product reviews. + * The information about the publisher, which may be a retailer, + * manufacturer, reviews service company, or any entity that publishes + * product reviews. + * + * Generated from protobuf field optional string publisher_name = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPublisherName() + { + return isset($this->publisher_name) ? $this->publisher_name : ''; + } + + public function hasPublisherName() + { + return isset($this->publisher_name); + } + + public function clearPublisherName() + { + unset($this->publisher_name); + } + + /** + * Optional. The name of the publisher of the product reviews. + * The information about the publisher, which may be a retailer, + * manufacturer, reviews service company, or any entity that publishes + * product reviews. + * + * Generated from protobuf field optional string publisher_name = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPublisherName($var) + { + GPBUtil::checkString($var, True); + $this->publisher_name = $var; + + return $this; + } + + /** + * Optional. A link to the company favicon of the publisher. The image + * dimensions should be favicon size: 16x16 pixels. The image format should be + * GIF, JPG or PNG. + * + * Generated from protobuf field optional string publisher_favicon = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPublisherFavicon() + { + return isset($this->publisher_favicon) ? $this->publisher_favicon : ''; + } + + public function hasPublisherFavicon() + { + return isset($this->publisher_favicon); + } + + public function clearPublisherFavicon() + { + unset($this->publisher_favicon); + } + + /** + * Optional. A link to the company favicon of the publisher. The image + * dimensions should be favicon size: 16x16 pixels. The image format should be + * GIF, JPG or PNG. + * + * Generated from protobuf field optional string publisher_favicon = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPublisherFavicon($var) + { + GPBUtil::checkString($var, True); + $this->publisher_favicon = $var; + + return $this; + } + + /** + * Optional. The author of the product review. + * A permanent, unique identifier for the author of the review in the + * publisher's system. + * + * Generated from protobuf field optional string reviewer_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewerId() + { + return isset($this->reviewer_id) ? $this->reviewer_id : ''; + } + + public function hasReviewerId() + { + return isset($this->reviewer_id); + } + + public function clearReviewerId() + { + unset($this->reviewer_id); + } + + /** + * Optional. The author of the product review. + * A permanent, unique identifier for the author of the review in the + * publisher's system. + * + * Generated from protobuf field optional string reviewer_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewerId($var) + { + GPBUtil::checkString($var, True); + $this->reviewer_id = $var; + + return $this; + } + + /** + * Optional. Set to true if the reviewer should remain anonymous. + * + * Generated from protobuf field optional bool reviewer_is_anonymous = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getReviewerIsAnonymous() + { + return isset($this->reviewer_is_anonymous) ? $this->reviewer_is_anonymous : false; + } + + public function hasReviewerIsAnonymous() + { + return isset($this->reviewer_is_anonymous); + } + + public function clearReviewerIsAnonymous() + { + unset($this->reviewer_is_anonymous); + } + + /** + * Optional. Set to true if the reviewer should remain anonymous. + * + * Generated from protobuf field optional bool reviewer_is_anonymous = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setReviewerIsAnonymous($var) + { + GPBUtil::checkBool($var); + $this->reviewer_is_anonymous = $var; + + return $this; + } + + /** + * Optional. The name of the reviewer of the product review. + * + * Generated from protobuf field optional string reviewer_username = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewerUsername() + { + return isset($this->reviewer_username) ? $this->reviewer_username : ''; + } + + public function hasReviewerUsername() + { + return isset($this->reviewer_username); + } + + public function clearReviewerUsername() + { + unset($this->reviewer_username); + } + + /** + * Optional. The name of the reviewer of the product review. + * + * Generated from protobuf field optional string reviewer_username = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewerUsername($var) + { + GPBUtil::checkString($var, True); + $this->reviewer_username = $var; + + return $this; + } + + /** + * Optional. The language of the review defined by BCP-47 language code. + * + * Generated from protobuf field optional string review_language = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewLanguage() + { + return isset($this->review_language) ? $this->review_language : ''; + } + + public function hasReviewLanguage() + { + return isset($this->review_language); + } + + public function clearReviewLanguage() + { + unset($this->review_language); + } + + /** + * Optional. The language of the review defined by BCP-47 language code. + * + * Generated from protobuf field optional string review_language = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewLanguage($var) + { + GPBUtil::checkString($var, True); + $this->review_language = $var; + + return $this; + } + + /** + * Optional. The country of the review defined by ISO 3166-1 Alpha-2 Country + * Code. + * + * Generated from protobuf field optional string review_country = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getReviewCountry() + { + return isset($this->review_country) ? $this->review_country : ''; + } + + public function hasReviewCountry() + { + return isset($this->review_country); + } + + public function clearReviewCountry() + { + unset($this->review_country); + } + + /** + * Optional. The country of the review defined by ISO 3166-1 Alpha-2 Country + * Code. + * + * Generated from protobuf field optional string review_country = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setReviewCountry($var) + { + GPBUtil::checkString($var, True); + $this->review_country = $var; + + return $this; + } + + /** + * Required. The timestamp indicating when the review was written. + * + * Generated from protobuf field .google.protobuf.Timestamp review_time = 10 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getReviewTime() + { + return $this->review_time; + } + + public function hasReviewTime() + { + return isset($this->review_time); + } + + public function clearReviewTime() + { + unset($this->review_time); + } + + /** + * Required. The timestamp indicating when the review was written. + * + * Generated from protobuf field .google.protobuf.Timestamp review_time = 10 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReviewTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->review_time = $var; + + return $this; + } + + /** + * Optional. The title of the review. + * + * Generated from protobuf field optional string title = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getTitle() + { + return isset($this->title) ? $this->title : ''; + } + + public function hasTitle() + { + return isset($this->title); + } + + public function clearTitle() + { + unset($this->title); + } + + /** + * Optional. The title of the review. + * + * Generated from protobuf field optional string title = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * Required. The content of the review. + * + * Generated from protobuf field optional string content = 12 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getContent() + { + return isset($this->content) ? $this->content : ''; + } + + public function hasContent() + { + return isset($this->content); + } + + public function clearContent() + { + unset($this->content); + } + + /** + * Required. The content of the review. + * + * Generated from protobuf field optional string content = 12 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * Optional. Contains the advantages based on the opinion of the reviewer. + * Omit boilerplate text like "pro:" unless it was written by the reviewer. + * + * Generated from protobuf field repeated string pros = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPros() + { + return $this->pros; + } + + /** + * Optional. Contains the advantages based on the opinion of the reviewer. + * Omit boilerplate text like "pro:" unless it was written by the reviewer. + * + * Generated from protobuf field repeated string pros = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPros($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pros = $arr; + + return $this; + } + + /** + * Optional. Contains the disadvantages based on the opinion of the reviewer. + * Omit boilerplate text like "con:" unless it was written by the reviewer. + * + * Generated from protobuf field repeated string cons = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCons() + { + return $this->cons; + } + + /** + * Optional. Contains the disadvantages based on the opinion of the reviewer. + * Omit boilerplate text like "con:" unless it was written by the reviewer. + * + * Generated from protobuf field repeated string cons = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCons($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->cons = $arr; + + return $this; + } + + /** + * Optional. The URI of the review landing page. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink review_link = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes\ReviewLink|null + */ + public function getReviewLink() + { + return $this->review_link; + } + + public function hasReviewLink() + { + return isset($this->review_link); + } + + public function clearReviewLink() + { + unset($this->review_link); + } + + /** + * Optional. The URI of the review landing page. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink review_link = 15 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes\ReviewLink $var + * @return $this + */ + public function setReviewLink($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes\ReviewLink::class); + $this->review_link = $var; + + return $this; + } + + /** + * Optional. A URI to an image of the reviewed product created by the review + * author. The URI does not have to end with an image file extension. + * + * Generated from protobuf field repeated string reviewer_image_links = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReviewerImageLinks() + { + return $this->reviewer_image_links; + } + + /** + * Optional. A URI to an image of the reviewed product created by the review + * author. The URI does not have to end with an image file extension. + * + * Generated from protobuf field repeated string reviewer_image_links = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReviewerImageLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->reviewer_image_links = $arr; + + return $this; + } + + /** + * Optional. Contains the ratings associated with the review. + * The minimum possible number for the rating. This should be the worst + * possible rating and should not be a value for no rating. + * + * Generated from protobuf field optional int64 min_rating = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMinRating() + { + return isset($this->min_rating) ? $this->min_rating : 0; + } + + public function hasMinRating() + { + return isset($this->min_rating); + } + + public function clearMinRating() + { + unset($this->min_rating); + } + + /** + * Optional. Contains the ratings associated with the review. + * The minimum possible number for the rating. This should be the worst + * possible rating and should not be a value for no rating. + * + * Generated from protobuf field optional int64 min_rating = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMinRating($var) + { + GPBUtil::checkInt64($var); + $this->min_rating = $var; + + return $this; + } + + /** + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min attribute. + * + * Generated from protobuf field optional int64 max_rating = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @return int|string + */ + public function getMaxRating() + { + return isset($this->max_rating) ? $this->max_rating : 0; + } + + public function hasMaxRating() + { + return isset($this->max_rating); + } + + public function clearMaxRating() + { + unset($this->max_rating); + } + + /** + * Optional. The maximum possible number for the rating. The value of the max + * rating must be greater than the value of the min attribute. + * + * Generated from protobuf field optional int64 max_rating = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @param int|string $var + * @return $this + */ + public function setMaxRating($var) + { + GPBUtil::checkInt64($var); + $this->max_rating = $var; + + return $this; + } + + /** + * Optional. The reviewer's overall rating of the product. + * + * Generated from protobuf field optional double rating = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getRating() + { + return isset($this->rating) ? $this->rating : 0.0; + } + + public function hasRating() + { + return isset($this->rating); + } + + public function clearRating() + { + unset($this->rating); + } + + /** + * Optional. The reviewer's overall rating of the product. + * + * Generated from protobuf field optional double rating = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setRating($var) + { + GPBUtil::checkDouble($var); + $this->rating = $var; + + return $this; + } + + /** + * Optional. Descriptive name of a product. + * + * Generated from protobuf field repeated string product_names = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductNames() + { + return $this->product_names; + } + + /** + * Optional. Descriptive name of a product. + * + * Generated from protobuf field repeated string product_names = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_names = $arr; + + return $this; + } + + /** + * Optional. The URI of the product. This URI can have the same value as the + * `review_link` element, if the review URI and the product URI are the + * same. + * + * Generated from protobuf field repeated string product_links = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductLinks() + { + return $this->product_links; + } + + /** + * Optional. The URI of the product. This URI can have the same value as the + * `review_link` element, if the review URI and the product URI are the + * same. + * + * Generated from protobuf field repeated string product_links = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_links = $arr; + + return $this; + } + + /** + * Optional. Contains ASINs (Amazon Standard Identification Numbers) + * associated with a product. + * + * Generated from protobuf field repeated string asins = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAsins() + { + return $this->asins; + } + + /** + * Optional. Contains ASINs (Amazon Standard Identification Numbers) + * associated with a product. + * + * Generated from protobuf field repeated string asins = 22 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAsins($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->asins = $arr; + + return $this; + } + + /** + * Optional. Contains GTINs (global trade item numbers) associated with a + * product. Sub-types of GTINs (e.g. UPC, EAN, ISBN, JAN) are supported. + * + * Generated from protobuf field repeated string gtins = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getGtins() + { + return $this->gtins; + } + + /** + * Optional. Contains GTINs (global trade item numbers) associated with a + * product. Sub-types of GTINs (e.g. UPC, EAN, ISBN, JAN) are supported. + * + * Generated from protobuf field repeated string gtins = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setGtins($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->gtins = $arr; + + return $this; + } + + /** + * Optional. Contains MPNs (manufacturer part numbers) associated with a + * product. + * + * Generated from protobuf field repeated string mpns = 24 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMpns() + { + return $this->mpns; + } + + /** + * Optional. Contains MPNs (manufacturer part numbers) associated with a + * product. + * + * Generated from protobuf field repeated string mpns = 24 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMpns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->mpns = $arr; + + return $this; + } + + /** + * Optional. Contains SKUs (stock keeping units) associated with a product. + * Often this matches the product Offer Id in the product feed. + * + * Generated from protobuf field repeated string skus = 25 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSkus() + { + return $this->skus; + } + + /** + * Optional. Contains SKUs (stock keeping units) associated with a product. + * Often this matches the product Offer Id in the product feed. + * + * Generated from protobuf field repeated string skus = 25 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSkus($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->skus = $arr; + + return $this; + } + + /** + * Optional. Contains brand names associated with a product. + * + * Generated from protobuf field repeated string brands = 26 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBrands() + { + return $this->brands; + } + + /** + * Optional. Contains brand names associated with a product. + * + * Generated from protobuf field repeated string brands = 26 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBrands($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->brands = $arr; + + return $this; + } + + /** + * Optional. Indicates whether the review is marked as spam in the publisher's + * system. + * + * Generated from protobuf field optional bool is_spam = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIsSpam() + { + return isset($this->is_spam) ? $this->is_spam : false; + } + + public function hasIsSpam() + { + return isset($this->is_spam); + } + + public function clearIsSpam() + { + unset($this->is_spam); + } + + /** + * Optional. Indicates whether the review is marked as spam in the publisher's + * system. + * + * Generated from protobuf field optional bool is_spam = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIsSpam($var) + { + GPBUtil::checkBool($var); + $this->is_spam = $var; + + return $this; + } + + /** + * Optional. The method used to collect the review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.CollectionMethod collection_method = 28 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCollectionMethod() + { + return $this->collection_method; + } + + /** + * Optional. The method used to collect the review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.CollectionMethod collection_method = 28 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCollectionMethod($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes\CollectionMethod::class); + $this->collection_method = $var; + + return $this; + } + + /** + * Optional. A permanent, unique identifier for the transaction associated + * with the review in the publisher's system. This ID can be used to indicate + * that multiple reviews are associated with the same transaction. + * + * Generated from protobuf field string transaction_id = 29 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getTransactionId() + { + return $this->transaction_id; + } + + /** + * Optional. A permanent, unique identifier for the transaction associated + * with the review in the publisher's system. This ID can be used to indicate + * that multiple reviews are associated with the same transaction. + * + * Generated from protobuf field string transaction_id = 29 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setTransactionId($var) + { + GPBUtil::checkString($var, True); + $this->transaction_id = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/CollectionMethod.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/CollectionMethod.php new file mode 100644 index 00000000000..324bce3b0c8 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/CollectionMethod.php @@ -0,0 +1,64 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.CollectionMethod + */ +class CollectionMethod +{ + /** + * Collection method unspecified. + * + * Generated from protobuf enum COLLECTION_METHOD_UNSPECIFIED = 0; + */ + const COLLECTION_METHOD_UNSPECIFIED = 0; + /** + * The user was not responding to a specific solicitation when they + * submitted the review. + * + * Generated from protobuf enum UNSOLICITED = 1; + */ + const UNSOLICITED = 1; + /** + * The user submitted the review in response to a solicitation after + * fulfillment of the user's order. + * + * Generated from protobuf enum POST_FULFILLMENT = 2; + */ + const POST_FULFILLMENT = 2; + + private static $valueToName = [ + self::COLLECTION_METHOD_UNSPECIFIED => 'COLLECTION_METHOD_UNSPECIFIED', + self::UNSOLICITED => 'UNSOLICITED', + self::POST_FULFILLMENT => 'POST_FULFILLMENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/ReviewLink.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/ReviewLink.php new file mode 100644 index 00000000000..843b5a18d57 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/ReviewLink.php @@ -0,0 +1,106 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink + */ +class ReviewLink extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Type of the review URI. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type = 0; + /** + * Optional. The URI of the review landing page. + * For example: `http://www.example.com/review_5.html`. + * + * Generated from protobuf field string link = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $link = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Optional. Type of the review URI. + * @type string $link + * Optional. The URI of the review landing page. + * For example: `http://www.example.com/review_5.html`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\ProductreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Type of the review URI. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Optional. Type of the review URI. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink.Type type = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewAttributes\ReviewLink\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Optional. The URI of the review landing page. + * For example: `http://www.example.com/review_5.html`. + * + * Generated from protobuf field string link = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLink() + { + return $this->link; + } + + /** + * Optional. The URI of the review landing page. + * For example: `http://www.example.com/review_5.html`. + * + * Generated from protobuf field string link = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLink($var) + { + GPBUtil::checkString($var, True); + $this->link = $var; + + return $this; + } + +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/ReviewLink/Type.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/ReviewLink/Type.php new file mode 100644 index 00000000000..79fb21dd5de --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewAttributes/ReviewLink/Type.php @@ -0,0 +1,62 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewAttributes.ReviewLink.Type + */ +class Type +{ + /** + * Type unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * The review page contains only this single review. + * + * Generated from protobuf enum SINGLETON = 1; + */ + const SINGLETON = 1; + /** + * The review page contains a group of reviews including this review. + * + * Generated from protobuf enum GROUP = 2; + */ + const GROUP = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::SINGLETON => 'SINGLETON', + self::GROUP => 'GROUP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus.php new file mode 100644 index 00000000000..38c48c19f05 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus.php @@ -0,0 +1,197 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewStatus + */ +class ProductReviewStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The intended destinations for the product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewDestinationStatus destination_statuses = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $destination_statuses; + /** + * Output only. A list of all issues associated with the product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue item_level_issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $item_level_issues; + /** + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $last_update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewDestinationStatus>|\Google\Protobuf\Internal\RepeatedField $destination_statuses + * Output only. The intended destinations for the product review. + * @type array<\Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewItemLevelIssue>|\Google\Protobuf\Internal\RepeatedField $item_level_issues + * Output only. A list of all issues associated with the product review. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * @type \Google\Protobuf\Timestamp $last_update_time + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\ProductreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The intended destinations for the product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewDestinationStatus destination_statuses = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinationStatuses() + { + return $this->destination_statuses; + } + + /** + * Output only. The intended destinations for the product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewDestinationStatus destination_statuses = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewDestinationStatus>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinationStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewDestinationStatus::class); + $this->destination_statuses = $arr; + + return $this; + } + + /** + * Output only. A list of all issues associated with the product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue item_level_issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItemLevelIssues() + { + return $this->item_level_issues; + } + + /** + * Output only. A list of all issues associated with the product review. + * + * Generated from protobuf field repeated .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue item_level_issues = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewItemLevelIssue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItemLevelIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewItemLevelIssue::class); + $this->item_level_issues = $arr; + + return $this; + } + + /** + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Date on which the item has been created, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateTime() + { + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + unset($this->last_update_time); + } + + /** + * Output only. Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + +} + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewDestinationStatus.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewDestinationStatus.php new file mode 100644 index 00000000000..57c7cc10cbc --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewDestinationStatus.php @@ -0,0 +1,68 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewDestinationStatus + */ +class ProductReviewDestinationStatus extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the reporting context. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reporting_context = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $reporting_context + * Output only. The name of the reporting context. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\ProductreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the reporting context. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getReportingContext() + { + return $this->reporting_context; + } + + /** + * Output only. The name of the reporting context. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setReportingContext($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Type\ReportingContext\ReportingContextEnum::class); + $this->reporting_context = $var; + + return $this; + } + +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewItemLevelIssue.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewItemLevelIssue.php new file mode 100644 index 00000000000..889c8a8087d --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewItemLevelIssue.php @@ -0,0 +1,310 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue + */ +class ProductReviewItemLevelIssue extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The error code of the issue. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $code = ''; + /** + * Output only. How this issue affects serving of the product review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue.Severity severity = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $severity = 0; + /** + * Output only. Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resolution = ''; + /** + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * + * Generated from protobuf field string attribute = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $attribute = ''; + /** + * Output only. The reporting context the issue applies to. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reporting_context = 0; + /** + * Output only. A short issue description in English. + * + * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $description = ''; + /** + * Output only. A detailed issue description in English. + * + * Generated from protobuf field string detail = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $detail = ''; + /** + * Output only. The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $documentation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $code + * Output only. The error code of the issue. + * @type int $severity + * Output only. How this issue affects serving of the product review. + * @type string $resolution + * Output only. Whether the issue can be resolved by the merchant. + * @type string $attribute + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * @type int $reporting_context + * Output only. The reporting context the issue applies to. + * @type string $description + * Output only. A short issue description in English. + * @type string $detail + * Output only. A detailed issue description in English. + * @type string $documentation + * Output only. The URL of a web page to help with resolving this issue. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Merchant\Reviews\V1Beta\ProductreviewsCommon::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The error code of the issue. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Output only. The error code of the issue. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + + /** + * Output only. How this issue affects serving of the product review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue.Severity severity = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * Output only. How this issue affects serving of the product review. + * + * Generated from protobuf field .google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue.Severity severity = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSeverity($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Reviews\V1beta\ProductReviewStatus\ProductReviewItemLevelIssue\Severity::class); + $this->severity = $var; + + return $this; + } + + /** + * Output only. Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getResolution() + { + return $this->resolution; + } + + /** + * Output only. Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setResolution($var) + { + GPBUtil::checkString($var, True); + $this->resolution = $var; + + return $this; + } + + /** + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * + * Generated from protobuf field string attribute = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * Output only. The attribute's name, if the issue is caused by a single + * attribute. + * + * Generated from protobuf field string attribute = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAttribute($var) + { + GPBUtil::checkString($var, True); + $this->attribute = $var; + + return $this; + } + + /** + * Output only. The reporting context the issue applies to. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getReportingContext() + { + return $this->reporting_context; + } + + /** + * Output only. The reporting context the issue applies to. + * + * Generated from protobuf field .google.shopping.type.ReportingContext.ReportingContextEnum reporting_context = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setReportingContext($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Type\ReportingContext\ReportingContextEnum::class); + $this->reporting_context = $var; + + return $this; + } + + /** + * Output only. A short issue description in English. + * + * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Output only. A short issue description in English. + * + * Generated from protobuf field string description = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. A detailed issue description in English. + * + * Generated from protobuf field string detail = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDetail() + { + return $this->detail; + } + + /** + * Output only. A detailed issue description in English. + * + * Generated from protobuf field string detail = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDetail($var) + { + GPBUtil::checkString($var, True); + $this->detail = $var; + + return $this; + } + + /** + * Output only. The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDocumentation() + { + return $this->documentation; + } + + /** + * Output only. The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDocumentation($var) + { + GPBUtil::checkString($var, True); + $this->documentation = $var; + + return $this; + } + +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewItemLevelIssue/Severity.php b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewItemLevelIssue/Severity.php new file mode 100644 index 00000000000..fb911e332c7 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/ProductReviewStatus/ProductReviewItemLevelIssue/Severity.php @@ -0,0 +1,63 @@ +google.shopping.merchant.reviews.v1beta.ProductReviewStatus.ProductReviewItemLevelIssue.Severity + */ +class Severity +{ + /** + * Not specified. + * + * Generated from protobuf enum SEVERITY_UNSPECIFIED = 0; + */ + const SEVERITY_UNSPECIFIED = 0; + /** + * This issue represents a warning and does not have a direct affect + * on the product review. + * + * Generated from protobuf enum NOT_IMPACTED = 1; + */ + const NOT_IMPACTED = 1; + /** + * Issue disapproves the product review. + * + * Generated from protobuf enum DISAPPROVED = 2; + */ + const DISAPPROVED = 2; + + private static $valueToName = [ + self::SEVERITY_UNSPECIFIED => 'SEVERITY_UNSPECIFIED', + self::NOT_IMPACTED => 'NOT_IMPACTED', + self::DISAPPROVED => 'DISAPPROVED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/ShoppingMerchantReviews/src/V1beta/gapic_metadata.json b/ShoppingMerchantReviews/src/V1beta/gapic_metadata.json new file mode 100644 index 00000000000..f87a719c334 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/gapic_metadata.json @@ -0,0 +1,67 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.shopping.merchant.reviews.v1beta", + "libraryPackage": "Google\\Shopping\\Merchant\\Reviews\\V1beta", + "services": { + "MerchantReviewsService": { + "clients": { + "grpc": { + "libraryClient": "MerchantReviewsServiceGapicClient", + "rpcs": { + "DeleteMerchantReview": { + "methods": [ + "deleteMerchantReview" + ] + }, + "GetMerchantReview": { + "methods": [ + "getMerchantReview" + ] + }, + "InsertMerchantReview": { + "methods": [ + "insertMerchantReview" + ] + }, + "ListMerchantReviews": { + "methods": [ + "listMerchantReviews" + ] + } + } + } + } + }, + "ProductReviewsService": { + "clients": { + "grpc": { + "libraryClient": "ProductReviewsServiceGapicClient", + "rpcs": { + "DeleteProductReview": { + "methods": [ + "deleteProductReview" + ] + }, + "GetProductReview": { + "methods": [ + "getProductReview" + ] + }, + "InsertProductReview": { + "methods": [ + "insertProductReview" + ] + }, + "ListProductReviews": { + "methods": [ + "listProductReviews" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_client_config.json b/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_client_config.json new file mode 100644 index 00000000000..3f1aa6160a3 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.shopping.merchant.reviews.v1beta.MerchantReviewsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "DeleteMerchantReview": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMerchantReview": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "InsertMerchantReview": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMerchantReviews": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_descriptor_config.php b/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_descriptor_config.php new file mode 100644 index 00000000000..c9db661e20d --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_descriptor_config.php @@ -0,0 +1,88 @@ + [ + 'google.shopping.merchant.reviews.v1beta.MerchantReviewsService' => [ + 'DeleteMerchantReview' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMerchantReview' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Reviews\V1beta\MerchantReview', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'InsertMerchantReview' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Reviews\V1beta\MerchantReview', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListMerchantReviews' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMerchantReviews', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Shopping\Merchant\Reviews\V1beta\ListMerchantReviewsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + 'merchantReview' => 'accounts/{account}/merchantReviews/{name}', + ], + ], + ], +]; diff --git a/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_rest_client_config.php b/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_rest_client_config.php new file mode 100644 index 00000000000..73f1938d82b --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/resources/merchant_reviews_service_rest_client_config.php @@ -0,0 +1,74 @@ + [ + 'google.shopping.merchant.reviews.v1beta.MerchantReviewsService' => [ + 'DeleteMerchantReview' => [ + 'method' => 'delete', + 'uriTemplate' => '/reviews/v1beta/{name=accounts/*/merchantReviews/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMerchantReview' => [ + 'method' => 'get', + 'uriTemplate' => '/reviews/v1beta/{name=accounts/*/merchantReviews/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'InsertMerchantReview' => [ + 'method' => 'post', + 'uriTemplate' => '/reviews/v1beta/{parent=accounts/*}/merchantReviews:insert', + 'body' => 'merchant_review', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMerchantReviews' => [ + 'method' => 'get', + 'uriTemplate' => '/reviews/v1beta/{parent=accounts/*}/merchantReviews', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_client_config.json b/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_client_config.json new file mode 100644 index 00000000000..959ab97081e --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.shopping.merchant.reviews.v1beta.ProductReviewsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "DeleteProductReview": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetProductReview": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "InsertProductReview": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListProductReviews": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_descriptor_config.php b/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_descriptor_config.php new file mode 100644 index 00000000000..f80704176cd --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_descriptor_config.php @@ -0,0 +1,88 @@ + [ + 'google.shopping.merchant.reviews.v1beta.ProductReviewsService' => [ + 'DeleteProductReview' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetProductReview' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Reviews\V1beta\ProductReview', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'InsertProductReview' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Merchant\Reviews\V1beta\ProductReview', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductReviews' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProductReviews', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Shopping\Merchant\Reviews\V1beta\ListProductReviewsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + 'productReview' => 'accounts/{account}/productReviews/{productreview}', + ], + ], + ], +]; diff --git a/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_rest_client_config.php b/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_rest_client_config.php new file mode 100644 index 00000000000..523f2adc552 --- /dev/null +++ b/ShoppingMerchantReviews/src/V1beta/resources/product_reviews_service_rest_client_config.php @@ -0,0 +1,74 @@ + [ + 'google.shopping.merchant.reviews.v1beta.ProductReviewsService' => [ + 'DeleteProductReview' => [ + 'method' => 'delete', + 'uriTemplate' => '/reviews/v1beta/{name=accounts/*/productReviews/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProductReview' => [ + 'method' => 'get', + 'uriTemplate' => '/reviews/v1beta/{name=accounts/*/productReviews/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'InsertProductReview' => [ + 'method' => 'post', + 'uriTemplate' => '/reviews/v1beta/{parent=accounts/*}/productReviews:insert', + 'body' => 'product_review', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProductReviews' => [ + 'method' => 'get', + 'uriTemplate' => '/reviews/v1beta/{parent=accounts/*}/productReviews', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingMerchantReviews/tests/Unit/V1beta/Client/MerchantReviewsServiceClientTest.php b/ShoppingMerchantReviews/tests/Unit/V1beta/Client/MerchantReviewsServiceClientTest.php new file mode 100644 index 00000000000..3d6bc298b5a --- /dev/null +++ b/ShoppingMerchantReviews/tests/Unit/V1beta/Client/MerchantReviewsServiceClientTest.php @@ -0,0 +1,402 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return MerchantReviewsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new MerchantReviewsServiceClient($options); + } + + /** @test */ + public function deleteMerchantReviewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->merchantReviewName('[ACCOUNT]', '[NAME]'); + $request = (new DeleteMerchantReviewRequest())->setName($formattedName); + $gapicClient->deleteMerchantReview($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.MerchantReviewsService/DeleteMerchantReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteMerchantReviewExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->merchantReviewName('[ACCOUNT]', '[NAME]'); + $request = (new DeleteMerchantReviewRequest())->setName($formattedName); + try { + $gapicClient->deleteMerchantReview($request); + // If the $gapicClient 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 getMerchantReviewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $merchantReviewId = 'merchantReviewId1682589099'; + $dataSource = 'dataSource-1333894576'; + $expectedResponse = new MerchantReview(); + $expectedResponse->setName($name2); + $expectedResponse->setMerchantReviewId($merchantReviewId); + $expectedResponse->setDataSource($dataSource); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->merchantReviewName('[ACCOUNT]', '[NAME]'); + $request = (new GetMerchantReviewRequest())->setName($formattedName); + $response = $gapicClient->getMerchantReview($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.MerchantReviewsService/GetMerchantReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMerchantReviewExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->merchantReviewName('[ACCOUNT]', '[NAME]'); + $request = (new GetMerchantReviewRequest())->setName($formattedName); + try { + $gapicClient->getMerchantReview($request); + // If the $gapicClient 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 insertMerchantReviewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $merchantReviewId = 'merchantReviewId1682589099'; + $dataSource2 = 'dataSource2-1972430333'; + $expectedResponse = new MerchantReview(); + $expectedResponse->setName($name); + $expectedResponse->setMerchantReviewId($merchantReviewId); + $expectedResponse->setDataSource($dataSource2); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $merchantReview = new MerchantReview(); + $merchantReviewMerchantReviewId = 'merchantReviewMerchantReviewId-1175491621'; + $merchantReview->setMerchantReviewId($merchantReviewMerchantReviewId); + $merchantReviewCustomAttributes = []; + $merchantReview->setCustomAttributes($merchantReviewCustomAttributes); + $dataSource = 'dataSource-1333894576'; + $request = (new InsertMerchantReviewRequest()) + ->setParent($parent) + ->setMerchantReview($merchantReview) + ->setDataSource($dataSource); + $response = $gapicClient->insertMerchantReview($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.MerchantReviewsService/InsertMerchantReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getMerchantReview(); + $this->assertProtobufEquals($merchantReview, $actualValue); + $actualValue = $actualRequestObject->getDataSource(); + $this->assertProtobufEquals($dataSource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function insertMerchantReviewExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 + $parent = 'parent-995424086'; + $merchantReview = new MerchantReview(); + $merchantReviewMerchantReviewId = 'merchantReviewMerchantReviewId-1175491621'; + $merchantReview->setMerchantReviewId($merchantReviewMerchantReviewId); + $merchantReviewCustomAttributes = []; + $merchantReview->setCustomAttributes($merchantReviewCustomAttributes); + $dataSource = 'dataSource-1333894576'; + $request = (new InsertMerchantReviewRequest()) + ->setParent($parent) + ->setMerchantReview($merchantReview) + ->setDataSource($dataSource); + try { + $gapicClient->insertMerchantReview($request); + // If the $gapicClient 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 listMerchantReviewsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $merchantReviewsElement = new MerchantReview(); + $merchantReviews = [$merchantReviewsElement]; + $expectedResponse = new ListMerchantReviewsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMerchantReviews($merchantReviews); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListMerchantReviewsRequest())->setParent($formattedParent); + $response = $gapicClient->listMerchantReviews($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMerchantReviews()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.MerchantReviewsService/ListMerchantReviews', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMerchantReviewsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListMerchantReviewsRequest())->setParent($formattedParent); + try { + $gapicClient->listMerchantReviews($request); + // If the $gapicClient 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 deleteMerchantReviewAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->merchantReviewName('[ACCOUNT]', '[NAME]'); + $request = (new DeleteMerchantReviewRequest())->setName($formattedName); + $gapicClient->deleteMerchantReviewAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.MerchantReviewsService/DeleteMerchantReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/ShoppingMerchantReviews/tests/Unit/V1beta/Client/ProductReviewsServiceClientTest.php b/ShoppingMerchantReviews/tests/Unit/V1beta/Client/ProductReviewsServiceClientTest.php new file mode 100644 index 00000000000..c291a9f8122 --- /dev/null +++ b/ShoppingMerchantReviews/tests/Unit/V1beta/Client/ProductReviewsServiceClientTest.php @@ -0,0 +1,398 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ProductReviewsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ProductReviewsServiceClient($options); + } + + /** @test */ + public function deleteProductReviewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + $request = (new DeleteProductReviewRequest())->setName($formattedName); + $gapicClient->deleteProductReview($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.ProductReviewsService/DeleteProductReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProductReviewExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + $request = (new DeleteProductReviewRequest())->setName($formattedName); + try { + $gapicClient->deleteProductReview($request); + // If the $gapicClient 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 getProductReviewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $productReviewId = 'productReviewId635814930'; + $dataSource = 'dataSource-1333894576'; + $expectedResponse = new ProductReview(); + $expectedResponse->setName($name2); + $expectedResponse->setProductReviewId($productReviewId); + $expectedResponse->setDataSource($dataSource); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + $request = (new GetProductReviewRequest())->setName($formattedName); + $response = $gapicClient->getProductReview($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.ProductReviewsService/GetProductReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProductReviewExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + $request = (new GetProductReviewRequest())->setName($formattedName); + try { + $gapicClient->getProductReview($request); + // If the $gapicClient 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 insertProductReviewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $productReviewId = 'productReviewId635814930'; + $dataSource2 = 'dataSource2-1972430333'; + $expectedResponse = new ProductReview(); + $expectedResponse->setName($name); + $expectedResponse->setProductReviewId($productReviewId); + $expectedResponse->setDataSource($dataSource2); + $transport->addResponse($expectedResponse); + // Mock request + $parent = 'parent-995424086'; + $productReview = new ProductReview(); + $productReviewProductReviewId = 'productReviewProductReviewId1743634555'; + $productReview->setProductReviewId($productReviewProductReviewId); + $dataSource = 'dataSource-1333894576'; + $request = (new InsertProductReviewRequest()) + ->setParent($parent) + ->setProductReview($productReview) + ->setDataSource($dataSource); + $response = $gapicClient->insertProductReview($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.ProductReviewsService/InsertProductReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($parent, $actualValue); + $actualValue = $actualRequestObject->getProductReview(); + $this->assertProtobufEquals($productReview, $actualValue); + $actualValue = $actualRequestObject->getDataSource(); + $this->assertProtobufEquals($dataSource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function insertProductReviewExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 + $parent = 'parent-995424086'; + $productReview = new ProductReview(); + $productReviewProductReviewId = 'productReviewProductReviewId1743634555'; + $productReview->setProductReviewId($productReviewProductReviewId); + $dataSource = 'dataSource-1333894576'; + $request = (new InsertProductReviewRequest()) + ->setParent($parent) + ->setProductReview($productReview) + ->setDataSource($dataSource); + try { + $gapicClient->insertProductReview($request); + // If the $gapicClient 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 listProductReviewsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $productReviewsElement = new ProductReview(); + $productReviews = [$productReviewsElement]; + $expectedResponse = new ListProductReviewsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProductReviews($productReviews); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListProductReviewsRequest())->setParent($formattedParent); + $response = $gapicClient->listProductReviews($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProductReviews()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.ProductReviewsService/ListProductReviews', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProductReviewsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $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 = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListProductReviewsRequest())->setParent($formattedParent); + try { + $gapicClient->listProductReviews($request); + // If the $gapicClient 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 deleteProductReviewAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->productReviewName('[ACCOUNT]', '[PRODUCTREVIEW]'); + $request = (new DeleteProductReviewRequest())->setName($formattedName); + $gapicClient->deleteProductReviewAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.shopping.merchant.reviews.v1beta.ProductReviewsService/DeleteProductReview', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 9677187cca0..b81d8ef08ca 100644 --- a/composer.json +++ b/composer.json @@ -261,6 +261,7 @@ "google/shopping-merchant-promotions": "0.1.1", "google/shopping-merchant-quota": "0.1.4", "google/shopping-merchant-reports": "0.8.2", + "google/shopping-merchant-reviews": "0.0.0", "googleads/ad-manager": "0.1.1", "googleads/marketingplatform-admin": "0.1.2" }, @@ -478,6 +479,7 @@ "GPBMetadata\\Google\\Shopping\\Merchant\\Promotions\\": "ShoppingMerchantPromotions/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Quota\\": "ShoppingMerchantQuota/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Reports\\": "ShoppingMerchantReports/metadata", + "GPBMetadata\\Google\\Shopping\\Merchant\\Reviews\\": "ShoppingMerchantReviews/metadata", "GPBMetadata\\Google\\Shopping\\Type\\": "ShoppingCommonProtos/metadata/Type", "GPBMetadata\\Google\\Spanner\\": "Spanner/metadata", "GPBMetadata\\Google\\Storage\\Control\\": "StorageControl/metadata", @@ -689,6 +691,7 @@ "Google\\Shopping\\Merchant\\Promotions\\": "ShoppingMerchantPromotions/src", "Google\\Shopping\\Merchant\\Quota\\": "ShoppingMerchantQuota/src", "Google\\Shopping\\Merchant\\Reports\\": "ShoppingMerchantReports/src", + "Google\\Shopping\\Merchant\\Reviews\\": "ShoppingMerchantReviews/src", "Google\\Shopping\\Type\\": "ShoppingCommonProtos/src/Type", "Google\\Type\\": "CommonProtos/src/Type", "Grafeas\\": "Grafeas/src"