diff --git a/.github/run-package-tests.sh b/.github/run-package-tests.sh index 18b50282fdf3..4a4245e1a653 100644 --- a/.github/run-package-tests.sh +++ b/.github/run-package-tests.sh @@ -29,7 +29,7 @@ FAILED_FILE=$(mktemp -d)/failed for DIR in ${DIRS}; do { cp ${DIR}/composer.json ${DIR}/composer-local.json # Update composer to use local packages - for i in BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos,0.1; do + for i in BigQuery,cloud-bigquery Core,cloud-core Logging,cloud-logging PubSub,cloud-pubsub Storage,cloud-storage ShoppingCommonProtos,shopping-common-protos,0.2; do IFS=","; set -- $i; if grep -q "\"google/$2\":" ${DIR}/composer.json; then if [ -z "$3" ]; then VERSION="1.100"; else VERSION=$3; fi diff --git a/ShoppingCss/.OwlBot.yaml b/ShoppingCss/.OwlBot.yaml new file mode 100644 index 000000000000..02cb8edf012d --- /dev/null +++ b/ShoppingCss/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/shopping/css/(v1)/.*-php/(.*) + dest: /owl-bot-staging/ShoppingCss/$1/$2 +api-name: ShoppingCss diff --git a/ShoppingCss/.gitattributes b/ShoppingCss/.gitattributes new file mode 100644 index 000000000000..8119e7fcc1b2 --- /dev/null +++ b/ShoppingCss/.gitattributes @@ -0,0 +1,8 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/.repo-metadata.json export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/ShoppingCss/.github/pull_request_template.md b/ShoppingCss/.github/pull_request_template.md new file mode 100644 index 000000000000..4dee93995f2d --- /dev/null +++ b/ShoppingCss/.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 `ShoppingCss/src`, and tests in `ShoppingCss/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/ShoppingCss/.repo-metadata.json b/ShoppingCss/.repo-metadata.json new file mode 100644 index 000000000000..d9e42ac0e1e3 --- /dev/null +++ b/ShoppingCss/.repo-metadata.json @@ -0,0 +1,8 @@ +{ + "language": "php", + "distribution_name": "google/shopping-css", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/shopping-css/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "css" +} diff --git a/ShoppingCss/CONTRIBUTING.md b/ShoppingCss/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/ShoppingCss/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/ShoppingCss/LICENSE b/ShoppingCss/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/ShoppingCss/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/ShoppingCss/README.md b/ShoppingCss/README.md new file mode 100644 index 000000000000..61a237c66658 --- /dev/null +++ b/ShoppingCss/README.md @@ -0,0 +1,45 @@ +# Google Shopping Css for PHP + +> Idiomatic PHP client for [Google Shopping Css](https://developers.google.com/comparison-shopping-services/api). + +[![Latest Stable Version](https://poser.pugx.org/google/shopping-css/v/stable)](https://packagist.org/packages/google/shopping-css) [![Packagist](https://img.shields.io/packagist/dm/google/shopping-css.svg)](https://packagist.org/packages/google/shopping-css) + +* [API documentation](https://cloud.google.com/php/docs/reference/shopping-css/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-css +``` + +> 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-css/tree/main/samples) for a canonical list of samples. + +### 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/comparison-shopping-services/api/guides/quickstart). diff --git a/ShoppingCss/VERSION b/ShoppingCss/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/ShoppingCss/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/ShoppingCss/composer.json b/ShoppingCss/composer.json new file mode 100644 index 000000000000..e75619b40306 --- /dev/null +++ b/ShoppingCss/composer.json @@ -0,0 +1,31 @@ +{ + "name": "google/shopping-css", + "description": "Google Shopping Css Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Shopping\\Css\\": "src", + "GPBMetadata\\Google\\Shopping\\Css\\": "metadata" + } + }, + "extra": { + "component": { + "id": "shopping-css", + "path": "ShoppingCss", + "target": "googleapis/php-shopping-css" + } + }, + "require": { + "php": ">=7.4", + "google/gax": "^1.25.0", + "google/shopping-common-protos": "^0.2.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/ShoppingCss/metadata/V1/Accounts.php b/ShoppingCss/metadata/V1/Accounts.php new file mode 100644 index 000000000000..bb28d8395466 Binary files /dev/null and b/ShoppingCss/metadata/V1/Accounts.php differ diff --git a/ShoppingCss/metadata/V1/AccountsLabels.php b/ShoppingCss/metadata/V1/AccountsLabels.php new file mode 100644 index 000000000000..4cfae5498a5a Binary files /dev/null and b/ShoppingCss/metadata/V1/AccountsLabels.php differ diff --git a/ShoppingCss/metadata/V1/CssProductCommon.php b/ShoppingCss/metadata/V1/CssProductCommon.php new file mode 100644 index 000000000000..2292a7adc7a7 Binary files /dev/null and b/ShoppingCss/metadata/V1/CssProductCommon.php differ diff --git a/ShoppingCss/metadata/V1/CssProductInputs.php b/ShoppingCss/metadata/V1/CssProductInputs.php new file mode 100644 index 000000000000..c80445e9a551 Binary files /dev/null and b/ShoppingCss/metadata/V1/CssProductInputs.php differ diff --git a/ShoppingCss/metadata/V1/CssProducts.php b/ShoppingCss/metadata/V1/CssProducts.php new file mode 100644 index 000000000000..f8cb7b5e4c51 --- /dev/null +++ b/ShoppingCss/metadata/V1/CssProducts.php @@ -0,0 +1,60 @@ +internalAddGeneratedFile( + ' +£ +)google/shopping/css/v1/css_products.protogoogle.shopping.css.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto/google/shopping/css/v1/css_product_common.proto google/shopping/type/types.proto"K +GetCssProductRequest3 +name ( B%àAúA +css.googleapis.com/CssProduct"ª + +CssProduct +name (  +raw_provided_id ( BàA +content_language ( BàA + +feed_label ( BàA; + +attributes ( 2".google.shopping.css.v1.AttributesBàAE +custom_attributes ( 2%.google.shopping.type.CustomAttributeBàAI +css_product_status ( 2(.google.shopping.css.v1.CssProductStatusBàA:iêAf +css.googleapis.com/CssProduct,accounts/{account}/cssProducts/{css_product}* cssProducts2 +cssProduct"v +ListCssProductsRequest5 +parent ( B%àAúAcss.googleapis.com/CssProduct + page_size ( + +page_token ( "l +ListCssProductsResponse8 + css_products ( 2".google.shopping.css.v1.CssProduct +next_page_token ( 2˜ +CssProductsService• + GetCssProduct,.google.shopping.css.v1.GetCssProductRequest".google.shopping.css.v1.CssProduct"2‚Óä“%#/v1/{name=accounts/*/cssProducts/*}ÚAname¨ +ListCssProducts..google.shopping.css.v1.ListCssProductsRequest/.google.shopping.css.v1.ListCssProductsResponse"4‚Óä“%#/v1/{parent=accounts/*}/cssProductsÚAparent?ÊAcss.googleapis.comÒA\'https://www.googleapis.com/auth/contentB² +com.google.shopping.css.v1BCssProductsProtoPZ2cloud.google.com/go/shopping/css/apiv1/csspb;csspbªGoogle.Shopping.Css.V1ÊGoogle\\Shopping\\Css\\V1êGoogle::Shopping::Css::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/ShoppingCss/owlbot.py b/ShoppingCss/owlbot.py new file mode 100644 index 000000000000..78e8cea912b0 --- /dev/null +++ b/ShoppingCss/owlbot.py @@ -0,0 +1,62 @@ +# Copyright 2023 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}/ShoppingCss").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, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + ] +) + +# 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', + '**/src/**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/ShoppingCss/phpunit.xml.dist b/ShoppingCss/phpunit.xml.dist new file mode 100644 index 000000000000..938222247187 --- /dev/null +++ b/ShoppingCss/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/ShoppingCss/samples/V1/AccountLabelsServiceClient/create_account_label.php b/ShoppingCss/samples/V1/AccountLabelsServiceClient/create_account_label.php new file mode 100644 index 000000000000..d86d0474eb30 --- /dev/null +++ b/ShoppingCss/samples/V1/AccountLabelsServiceClient/create_account_label.php @@ -0,0 +1,74 @@ +setParent($formattedParent) + ->setAccountLabel($accountLabel); + + // Call the API and handle any network failures. + try { + /** @var AccountLabel $response */ + $response = $accountLabelsServiceClient->createAccountLabel($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 +{ + $formattedParent = AccountLabelsServiceClient::accountName('[ACCOUNT]'); + + create_account_label_sample($formattedParent); +} +// [END css_v1_generated_AccountLabelsService_CreateAccountLabel_sync] diff --git a/ShoppingCss/samples/V1/AccountLabelsServiceClient/delete_account_label.php b/ShoppingCss/samples/V1/AccountLabelsServiceClient/delete_account_label.php new file mode 100644 index 000000000000..745fdaa15d51 --- /dev/null +++ b/ShoppingCss/samples/V1/AccountLabelsServiceClient/delete_account_label.php @@ -0,0 +1,70 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $accountLabelsServiceClient->deleteAccountLabel($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 = AccountLabelsServiceClient::accountLabelName('[ACCOUNT]', '[LABEL]'); + + delete_account_label_sample($formattedName); +} +// [END css_v1_generated_AccountLabelsService_DeleteAccountLabel_sync] diff --git a/ShoppingCss/samples/V1/AccountLabelsServiceClient/list_account_labels.php b/ShoppingCss/samples/V1/AccountLabelsServiceClient/list_account_labels.php new file mode 100644 index 000000000000..7e50b0c552c7 --- /dev/null +++ b/ShoppingCss/samples/V1/AccountLabelsServiceClient/list_account_labels.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $accountLabelsServiceClient->listAccountLabels($request); + + /** @var AccountLabel $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 = AccountLabelsServiceClient::accountName('[ACCOUNT]'); + + list_account_labels_sample($formattedParent); +} +// [END css_v1_generated_AccountLabelsService_ListAccountLabels_sync] diff --git a/ShoppingCss/samples/V1/AccountLabelsServiceClient/update_account_label.php b/ShoppingCss/samples/V1/AccountLabelsServiceClient/update_account_label.php new file mode 100644 index 000000000000..e96ddb74a8ff --- /dev/null +++ b/ShoppingCss/samples/V1/AccountLabelsServiceClient/update_account_label.php @@ -0,0 +1,59 @@ +setAccountLabel($accountLabel); + + // Call the API and handle any network failures. + try { + /** @var AccountLabel $response */ + $response = $accountLabelsServiceClient->updateAccountLabel($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END css_v1_generated_AccountLabelsService_UpdateAccountLabel_sync] diff --git a/ShoppingCss/samples/V1/AccountsServiceClient/get_account.php b/ShoppingCss/samples/V1/AccountsServiceClient/get_account.php new file mode 100644 index 000000000000..ae573dbe50d0 --- /dev/null +++ b/ShoppingCss/samples/V1/AccountsServiceClient/get_account.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Account $response */ + $response = $accountsServiceClient->getAccount($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 = AccountsServiceClient::accountName('[ACCOUNT]'); + + get_account_sample($formattedName); +} +// [END css_v1_generated_AccountsService_GetAccount_sync] diff --git a/ShoppingCss/samples/V1/AccountsServiceClient/list_child_accounts.php b/ShoppingCss/samples/V1/AccountsServiceClient/list_child_accounts.php new file mode 100644 index 000000000000..b2405d3d3356 --- /dev/null +++ b/ShoppingCss/samples/V1/AccountsServiceClient/list_child_accounts.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $accountsServiceClient->listChildAccounts($request); + + /** @var Account $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 = AccountsServiceClient::accountName('[ACCOUNT]'); + + list_child_accounts_sample($formattedParent); +} +// [END css_v1_generated_AccountsService_ListChildAccounts_sync] diff --git a/ShoppingCss/samples/V1/AccountsServiceClient/update_labels.php b/ShoppingCss/samples/V1/AccountsServiceClient/update_labels.php new file mode 100644 index 000000000000..ebbaa7a323d5 --- /dev/null +++ b/ShoppingCss/samples/V1/AccountsServiceClient/update_labels.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Account $response */ + $response = $accountsServiceClient->updateLabels($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 = AccountsServiceClient::accountName('[ACCOUNT]'); + + update_labels_sample($formattedName); +} +// [END css_v1_generated_AccountsService_UpdateLabels_sync] diff --git a/ShoppingCss/samples/V1/CssProductInputsServiceClient/delete_css_product_input.php b/ShoppingCss/samples/V1/CssProductInputsServiceClient/delete_css_product_input.php new file mode 100644 index 000000000000..1fcec47a273f --- /dev/null +++ b/ShoppingCss/samples/V1/CssProductInputsServiceClient/delete_css_product_input.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $cssProductInputsServiceClient->deleteCssProductInput($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 = CssProductInputsServiceClient::cssProductInputName( + '[ACCOUNT]', + '[CSS_PRODUCT_INPUT]' + ); + + delete_css_product_input_sample($formattedName); +} +// [END css_v1_generated_CssProductInputsService_DeleteCssProductInput_sync] diff --git a/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php b/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php new file mode 100644 index 000000000000..7a1417df00ba --- /dev/null +++ b/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php @@ -0,0 +1,116 @@ +setRawProvidedId($cssProductInputRawProvidedId) + ->setContentLanguage($cssProductInputContentLanguage) + ->setFeedLabel($cssProductInputFeedLabel); + $request = (new InsertCssProductInputRequest()) + ->setParent($formattedParent) + ->setCssProductInput($cssProductInput) + ->setFeedId($feedId); + + // Call the API and handle any network failures. + try { + /** @var CssProductInput $response */ + $response = $cssProductInputsServiceClient->insertCssProductInput($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 +{ + $formattedParent = CssProductInputsServiceClient::accountName('[ACCOUNT]'); + $cssProductInputRawProvidedId = '[RAW_PROVIDED_ID]'; + $cssProductInputContentLanguage = '[CONTENT_LANGUAGE]'; + $cssProductInputFeedLabel = '[FEED_LABEL]'; + $feedId = 0; + + insert_css_product_input_sample( + $formattedParent, + $cssProductInputRawProvidedId, + $cssProductInputContentLanguage, + $cssProductInputFeedLabel, + $feedId + ); +} +// [END css_v1_generated_CssProductInputsService_InsertCssProductInput_sync] diff --git a/ShoppingCss/samples/V1/CssProductsServiceClient/get_css_product.php b/ShoppingCss/samples/V1/CssProductsServiceClient/get_css_product.php new file mode 100644 index 000000000000..f51ba918c6a9 --- /dev/null +++ b/ShoppingCss/samples/V1/CssProductsServiceClient/get_css_product.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var CssProduct $response */ + $response = $cssProductsServiceClient->getCssProduct($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 = CssProductsServiceClient::cssProductName('[ACCOUNT]', '[CSS_PRODUCT]'); + + get_css_product_sample($formattedName); +} +// [END css_v1_generated_CssProductsService_GetCssProduct_sync] diff --git a/ShoppingCss/samples/V1/CssProductsServiceClient/list_css_products.php b/ShoppingCss/samples/V1/CssProductsServiceClient/list_css_products.php new file mode 100644 index 000000000000..cad54268fb98 --- /dev/null +++ b/ShoppingCss/samples/V1/CssProductsServiceClient/list_css_products.php @@ -0,0 +1,83 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $cssProductsServiceClient->listCssProducts($request); + + /** @var CssProduct $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 = CssProductsServiceClient::accountName('[ACCOUNT]'); + + list_css_products_sample($formattedParent); +} +// [END css_v1_generated_CssProductsService_ListCssProducts_sync] diff --git a/ShoppingCss/src/V1/Account.php b/ShoppingCss/src/V1/Account.php new file mode 100644 index 000000000000..f8acc6253f68 --- /dev/null +++ b/ShoppingCss/src/V1/Account.php @@ -0,0 +1,355 @@ +google.shopping.css.v1.Account + */ +class Account extends \Google\Protobuf\Internal\Message +{ + /** + * The label resource name. + * Format: accounts/{account} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. Immutable. The CSS/MC account's full name. + * + * Generated from protobuf field string full_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $full_name = ''; + /** + * The CSS/MC account's short display name. + * + * Generated from protobuf field optional string display_name = 3; + */ + protected $display_name = null; + /** + * Output only. Immutable. The CSS/MC account's homepage. + * + * Generated from protobuf field optional string homepage_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $homepage_uri = null; + /** + * The CSS/MC account's parent resource. CSS group for CSS domains; CSS + * domain for MC accounts. Returned only if the user has access to the + * parent account. + * + * Generated from protobuf field optional string parent = 5; + */ + protected $parent = null; + /** + * Manually created label IDs assigned to the CSS/MC account by a CSS parent + * account. + * + * Generated from protobuf field repeated int64 label_ids = 6; + */ + private $label_ids; + /** + * Automatically created label IDs assigned to the MC account by + * CSS Center. + * + * Generated from protobuf field repeated int64 automatic_label_ids = 7; + */ + private $automatic_label_ids; + /** + * Output only. The type of this account. + * + * Generated from protobuf field .google.shopping.css.v1.Account.AccountType account_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $account_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The label resource name. + * Format: accounts/{account} + * @type string $full_name + * Output only. Immutable. The CSS/MC account's full name. + * @type string $display_name + * The CSS/MC account's short display name. + * @type string $homepage_uri + * Output only. Immutable. The CSS/MC account's homepage. + * @type string $parent + * The CSS/MC account's parent resource. CSS group for CSS domains; CSS + * domain for MC accounts. Returned only if the user has access to the + * parent account. + * @type array|array|\Google\Protobuf\Internal\RepeatedField $label_ids + * Manually created label IDs assigned to the CSS/MC account by a CSS parent + * account. + * @type array|array|\Google\Protobuf\Internal\RepeatedField $automatic_label_ids + * Automatically created label IDs assigned to the MC account by + * CSS Center. + * @type int $account_type + * Output only. The type of this account. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\Accounts::initOnce(); + parent::__construct($data); + } + + /** + * The label resource name. + * Format: accounts/{account} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The label resource name. + * Format: accounts/{account} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Immutable. The CSS/MC account's full name. + * + * Generated from protobuf field string full_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getFullName() + { + return $this->full_name; + } + + /** + * Output only. Immutable. The CSS/MC account's full name. + * + * Generated from protobuf field string full_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setFullName($var) + { + GPBUtil::checkString($var, True); + $this->full_name = $var; + + return $this; + } + + /** + * The CSS/MC account's short display name. + * + * Generated from protobuf field optional string display_name = 3; + * @return string + */ + public function getDisplayName() + { + return isset($this->display_name) ? $this->display_name : ''; + } + + public function hasDisplayName() + { + return isset($this->display_name); + } + + public function clearDisplayName() + { + unset($this->display_name); + } + + /** + * The CSS/MC account's short display name. + * + * Generated from protobuf field optional string display_name = 3; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. Immutable. The CSS/MC account's homepage. + * + * Generated from protobuf field optional string homepage_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getHomepageUri() + { + return isset($this->homepage_uri) ? $this->homepage_uri : ''; + } + + public function hasHomepageUri() + { + return isset($this->homepage_uri); + } + + public function clearHomepageUri() + { + unset($this->homepage_uri); + } + + /** + * Output only. Immutable. The CSS/MC account's homepage. + * + * Generated from protobuf field optional string homepage_uri = 4 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setHomepageUri($var) + { + GPBUtil::checkString($var, True); + $this->homepage_uri = $var; + + return $this; + } + + /** + * The CSS/MC account's parent resource. CSS group for CSS domains; CSS + * domain for MC accounts. Returned only if the user has access to the + * parent account. + * + * Generated from protobuf field optional string parent = 5; + * @return string + */ + public function getParent() + { + return isset($this->parent) ? $this->parent : ''; + } + + public function hasParent() + { + return isset($this->parent); + } + + public function clearParent() + { + unset($this->parent); + } + + /** + * The CSS/MC account's parent resource. CSS group for CSS domains; CSS + * domain for MC accounts. Returned only if the user has access to the + * parent account. + * + * Generated from protobuf field optional string parent = 5; + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Manually created label IDs assigned to the CSS/MC account by a CSS parent + * account. + * + * Generated from protobuf field repeated int64 label_ids = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabelIds() + { + return $this->label_ids; + } + + /** + * Manually created label IDs assigned to the CSS/MC account by a CSS parent + * account. + * + * Generated from protobuf field repeated int64 label_ids = 6; + * @param array|array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabelIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64); + $this->label_ids = $arr; + + return $this; + } + + /** + * Automatically created label IDs assigned to the MC account by + * CSS Center. + * + * Generated from protobuf field repeated int64 automatic_label_ids = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAutomaticLabelIds() + { + return $this->automatic_label_ids; + } + + /** + * Automatically created label IDs assigned to the MC account by + * CSS Center. + * + * Generated from protobuf field repeated int64 automatic_label_ids = 7; + * @param array|array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAutomaticLabelIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64); + $this->automatic_label_ids = $arr; + + return $this; + } + + /** + * Output only. The type of this account. + * + * Generated from protobuf field .google.shopping.css.v1.Account.AccountType account_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getAccountType() + { + return $this->account_type; + } + + /** + * Output only. The type of this account. + * + * Generated from protobuf field .google.shopping.css.v1.Account.AccountType account_type = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setAccountType($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Css\V1\Account\AccountType::class); + $this->account_type = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/Account/AccountType.php b/ShoppingCss/src/V1/Account/AccountType.php new file mode 100644 index 000000000000..a0638bf28b4f --- /dev/null +++ b/ShoppingCss/src/V1/Account/AccountType.php @@ -0,0 +1,104 @@ +google.shopping.css.v1.Account.AccountType + */ +class AccountType +{ + /** + * Unknown account type. + * + * Generated from protobuf enum ACCOUNT_TYPE_UNSPECIFIED = 0; + */ + const ACCOUNT_TYPE_UNSPECIFIED = 0; + /** + * CSS group account. + * + * Generated from protobuf enum CSS_GROUP = 1; + */ + const CSS_GROUP = 1; + /** + * CSS domain account. + * + * Generated from protobuf enum CSS_DOMAIN = 2; + */ + const CSS_DOMAIN = 2; + /** + * MC Primary CSS MCA account. + * + * Generated from protobuf enum MC_PRIMARY_CSS_MCA = 3; + */ + const MC_PRIMARY_CSS_MCA = 3; + /** + * MC CSS MCA account. + * + * Generated from protobuf enum MC_CSS_MCA = 4; + */ + const MC_CSS_MCA = 4; + /** + * MC Marketplace MCA account. + * + * Generated from protobuf enum MC_MARKETPLACE_MCA = 5; + */ + const MC_MARKETPLACE_MCA = 5; + /** + * MC Other MCA account. + * + * Generated from protobuf enum MC_OTHER_MCA = 6; + */ + const MC_OTHER_MCA = 6; + /** + * MC Standalone account. + * + * Generated from protobuf enum MC_STANDALONE = 7; + */ + const MC_STANDALONE = 7; + /** + * MC MCA sub-account. + * + * Generated from protobuf enum MC_MCA_SUBACCOUNT = 8; + */ + const MC_MCA_SUBACCOUNT = 8; + + private static $valueToName = [ + self::ACCOUNT_TYPE_UNSPECIFIED => 'ACCOUNT_TYPE_UNSPECIFIED', + self::CSS_GROUP => 'CSS_GROUP', + self::CSS_DOMAIN => 'CSS_DOMAIN', + self::MC_PRIMARY_CSS_MCA => 'MC_PRIMARY_CSS_MCA', + self::MC_CSS_MCA => 'MC_CSS_MCA', + self::MC_MARKETPLACE_MCA => 'MC_MARKETPLACE_MCA', + self::MC_OTHER_MCA => 'MC_OTHER_MCA', + self::MC_STANDALONE => 'MC_STANDALONE', + self::MC_MCA_SUBACCOUNT => 'MC_MCA_SUBACCOUNT', + ]; + + 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/ShoppingCss/src/V1/AccountLabel.php b/ShoppingCss/src/V1/AccountLabel.php new file mode 100644 index 000000000000..aa19018c031c --- /dev/null +++ b/ShoppingCss/src/V1/AccountLabel.php @@ -0,0 +1,261 @@ +google.shopping.css.v1.AccountLabel + */ +class AccountLabel extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the label. + * Format: accounts/{account}/labels/{label} + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The ID of the label. + * + * Generated from protobuf field int64 label_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $label_id = 0; + /** + * Output only. The ID of account this label belongs to. + * + * Generated from protobuf field int64 account_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $account_id = 0; + /** + * The display name of this label. + * + * Generated from protobuf field optional string display_name = 4; + */ + protected $display_name = null; + /** + * The description of this label. + * + * Generated from protobuf field optional string description = 5; + */ + protected $description = null; + /** + * Output only. The type of this label. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel.LabelType label_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $label_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the label. + * Format: accounts/{account}/labels/{label} + * @type int|string $label_id + * Output only. The ID of the label. + * @type int|string $account_id + * Output only. The ID of account this label belongs to. + * @type string $display_name + * The display name of this label. + * @type string $description + * The description of this label. + * @type int $label_type + * Output only. The type of this label. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\AccountsLabels::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the label. + * Format: accounts/{account}/labels/{label} + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the label. + * Format: accounts/{account}/labels/{label} + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The ID of the label. + * + * Generated from protobuf field int64 label_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getLabelId() + { + return $this->label_id; + } + + /** + * Output only. The ID of the label. + * + * Generated from protobuf field int64 label_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setLabelId($var) + { + GPBUtil::checkInt64($var); + $this->label_id = $var; + + return $this; + } + + /** + * Output only. The ID of account this label belongs to. + * + * Generated from protobuf field int64 account_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getAccountId() + { + return $this->account_id; + } + + /** + * Output only. The ID of account this label belongs to. + * + * Generated from protobuf field int64 account_id = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setAccountId($var) + { + GPBUtil::checkInt64($var); + $this->account_id = $var; + + return $this; + } + + /** + * The display name of this label. + * + * Generated from protobuf field optional string display_name = 4; + * @return string + */ + public function getDisplayName() + { + return isset($this->display_name) ? $this->display_name : ''; + } + + public function hasDisplayName() + { + return isset($this->display_name); + } + + public function clearDisplayName() + { + unset($this->display_name); + } + + /** + * The display name of this label. + * + * Generated from protobuf field optional string display_name = 4; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The description of this label. + * + * Generated from protobuf field optional string description = 5; + * @return string + */ + public function getDescription() + { + return isset($this->description) ? $this->description : ''; + } + + public function hasDescription() + { + return isset($this->description); + } + + public function clearDescription() + { + unset($this->description); + } + + /** + * The description of this label. + * + * Generated from protobuf field optional string description = 5; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The type of this label. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel.LabelType label_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getLabelType() + { + return $this->label_type; + } + + /** + * Output only. The type of this label. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel.LabelType label_type = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setLabelType($var) + { + GPBUtil::checkEnum($var, \Google\Shopping\Css\V1\AccountLabel\LabelType::class); + $this->label_type = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/AccountLabel/LabelType.php b/ShoppingCss/src/V1/AccountLabel/LabelType.php new file mode 100644 index 000000000000..21d2fad2ce64 --- /dev/null +++ b/ShoppingCss/src/V1/AccountLabel/LabelType.php @@ -0,0 +1,62 @@ +google.shopping.css.v1.AccountLabel.LabelType + */ +class LabelType +{ + /** + * Unknown label type. + * + * Generated from protobuf enum LABEL_TYPE_UNSPECIFIED = 0; + */ + const LABEL_TYPE_UNSPECIFIED = 0; + /** + * Indicates that the label was created manually. + * + * Generated from protobuf enum MANUAL = 1; + */ + const MANUAL = 1; + /** + * Indicates that the label was created automatically by CSS Center. + * + * Generated from protobuf enum AUTOMATIC = 2; + */ + const AUTOMATIC = 2; + + private static $valueToName = [ + self::LABEL_TYPE_UNSPECIFIED => 'LABEL_TYPE_UNSPECIFIED', + self::MANUAL => 'MANUAL', + self::AUTOMATIC => 'AUTOMATIC', + ]; + + 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/ShoppingCss/src/V1/Attributes.php b/ShoppingCss/src/V1/Attributes.php new file mode 100644 index 000000000000..dd89de814e3e --- /dev/null +++ b/ShoppingCss/src/V1/Attributes.php @@ -0,0 +1,2193 @@ +google.shopping.css.v1.Attributes + */ +class Attributes extends \Google\Protobuf\Internal\Message +{ + /** + * URL directly linking to your the Product Detail Page of the CSS. + * + * Generated from protobuf field optional string cpp_link = 1; + */ + protected $cpp_link = null; + /** + * URL for the mobile-optimized version of the Product Detail Page of the CSS. + * + * Generated from protobuf field optional string cpp_mobile_link = 2; + */ + protected $cpp_mobile_link = null; + /** + * Allows advertisers to override the item URL when the product is shown + * within the context of Product Ads. + * + * Generated from protobuf field optional string cpp_ads_redirect = 42; + */ + protected $cpp_ads_redirect = null; + /** + * Low Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price low_price = 3; + */ + protected $low_price = null; + /** + * High Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price high_price = 4; + */ + protected $high_price = null; + /** + * The number of aggregate offers. + * + * Generated from protobuf field optional int64 number_of_offers = 5; + */ + protected $number_of_offers = null; + /** + * Condition of the headline offer. + * + * Generated from protobuf field optional string headline_offer_condition = 6; + */ + protected $headline_offer_condition = null; + /** + * Headline Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price headline_offer_price = 7; + */ + protected $headline_offer_price = null; + /** + * Link to the headline offer. + * + * Generated from protobuf field optional string headline_offer_link = 8; + */ + protected $headline_offer_link = null; + /** + * Mobile Link to the headline offer. + * + * Generated from protobuf field optional string headline_offer_mobile_link = 9; + */ + protected $headline_offer_mobile_link = null; + /** + * Headline Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price headline_offer_shipping_price = 41; + */ + protected $headline_offer_shipping_price = null; + /** + * Title of the item. + * + * Generated from protobuf field optional string title = 10; + */ + protected $title = null; + /** + * URL of an image of the item. + * + * Generated from protobuf field optional string image_link = 11; + */ + protected $image_link = null; + /** + * Additional URL of images of the item. + * + * Generated from protobuf field repeated string additional_image_links = 12; + */ + private $additional_image_links; + /** + * Description of the item. + * + * Generated from protobuf field optional string description = 13; + */ + protected $description = null; + /** + * Product Related Attributes.[14-36] + * Brand of the item. + * + * Generated from protobuf field optional string brand = 14; + */ + protected $brand = null; + /** + * Manufacturer Part Number + * ([MPN](https://support.google.com/merchants/answer/188494#mpn)) of the + * item. + * + * Generated from protobuf field optional string mpn = 15; + */ + protected $mpn = null; + /** + * Global Trade Item Number + * ([GTIN](https://support.google.com/merchants/answer/188494#gtin)) of the + * item. + * + * Generated from protobuf field optional string gtin = 16; + */ + protected $gtin = null; + /** + * Categories of the item (formatted as in [products data + * specification](https://support.google.com/merchants/answer/6324406)). + * + * Generated from protobuf field repeated string product_types = 36; + */ + private $product_types; + /** + * Google's category of the item (see [Google product + * taxonomy](https://support.google.com/merchants/answer/1705911)). When + * querying products, this field will contain the user provided value. There + * is currently no way to get back the auto assigned google product + * categories through the API. + * + * Generated from protobuf field optional string google_product_category = 17; + */ + protected $google_product_category = null; + /** + * Set to true if the item is targeted towards adults. + * + * Generated from protobuf field optional bool adult = 18; + */ + protected $adult = null; + /** + * The number of identical products in a merchant-defined multipack. + * + * Generated from protobuf field optional int64 multipack = 19; + */ + protected $multipack = null; + /** + * Whether the item is a merchant-defined bundle. A bundle is a custom + * grouping of different products sold by a merchant for a single price. + * + * Generated from protobuf field optional bool is_bundle = 20; + */ + protected $is_bundle = null; + /** + * Target age group of the item. + * + * Generated from protobuf field optional string age_group = 21; + */ + protected $age_group = null; + /** + * Color of the item. + * + * Generated from protobuf field optional string color = 22; + */ + protected $color = null; + /** + * Target gender of the item. + * + * Generated from protobuf field optional string gender = 23; + */ + protected $gender = null; + /** + * The material of which the item is made. + * + * Generated from protobuf field optional string material = 24; + */ + protected $material = null; + /** + * The item's pattern (e.g. polka dots). + * + * Generated from protobuf field optional string pattern = 25; + */ + protected $pattern = null; + /** + * Size of the item. Only one value is allowed. For variants with different + * sizes, insert a separate product for each size with the same + * `itemGroupId` value (see + * [https://support.google.com/merchants/answer/6324492](size definition)). + * + * Generated from protobuf field optional string size = 26; + */ + protected $size = null; + /** + * System in which the size is specified. Recommended for apparel items. + * + * Generated from protobuf field optional string size_system = 27; + */ + protected $size_system = null; + /** + * The cut of the item. It can be used to represent combined size types for + * apparel items. Maximum two of size types can be provided (see + * [https://support.google.com/merchants/answer/6324497](size type)). + * + * Generated from protobuf field repeated string size_types = 28; + */ + private $size_types; + /** + * Shared identifier for all variants of the same product. + * + * Generated from protobuf field optional string item_group_id = 29; + */ + protected $item_group_id = null; + /** + * Technical specification or additional product details. + * + * Generated from protobuf field repeated .google.shopping.css.v1.ProductDetail product_details = 30; + */ + private $product_details; + /** + * The weight of the product in the units provided. The value must be + * between 0 (exclusive) and 2000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductWeight product_weight = 31; + */ + protected $product_weight = null; + /** + * The length of the product in the units provided. The value must be + * between 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_length = 32; + */ + protected $product_length = null; + /** + * The width of the product in the units provided. The value must be between + * 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_width = 33; + */ + protected $product_width = null; + /** + * The height of the product in the units provided. The value must be + * between + * 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_height = 34; + */ + protected $product_height = null; + /** + * Bullet points describing the most relevant highlights of a product. + * + * Generated from protobuf field repeated string product_highlights = 35; + */ + private $product_highlights; + /** + * A list of certificates claimed by the CSS for the given product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.Certification certifications = 39; + */ + private $certifications; + /** + * Date on which the item should expire, as specified upon insertion, in + * [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. The actual + * expiration date in Google Shopping is exposed in `productstatuses` as + * [googleExpirationDate](https://support.google.com/merchants/answer/6324499) + * and might be earlier if `expirationDate` is too far in the future. + * Note: It may take 2+ days from the expiration date for the item to + * actually get deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_date = 40; + */ + protected $expiration_date = null; + /** + * The list of destinations to include for this target (corresponds to + * checked check boxes in Merchant Center). Default destinations are always + * included unless provided in `excludedDestinations`. + * + * Generated from protobuf field repeated string included_destinations = 43; + */ + private $included_destinations; + /** + * The list of destinations to exclude for this target (corresponds to + * unchecked check boxes in Merchant Center). + * + * Generated from protobuf field repeated string excluded_destinations = 44; + */ + private $excluded_destinations; + /** + * Publication of this item will be temporarily paused. + * + * Generated from protobuf field optional string pause = 45; + */ + protected $pause = null; + /** + * Custom label 0 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_0 = 46; + */ + protected $custom_label_0 = null; + /** + * Custom label 1 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_1 = 47; + */ + protected $custom_label_1 = null; + /** + * Custom label 2 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_2 = 48; + */ + protected $custom_label_2 = null; + /** + * Custom label 3 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_3 = 49; + */ + protected $custom_label_3 = null; + /** + * Custom label 4 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_4 = 50; + */ + protected $custom_label_4 = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cpp_link + * URL directly linking to your the Product Detail Page of the CSS. + * @type string $cpp_mobile_link + * URL for the mobile-optimized version of the Product Detail Page of the CSS. + * @type string $cpp_ads_redirect + * Allows advertisers to override the item URL when the product is shown + * within the context of Product Ads. + * @type \Google\Shopping\Type\Price $low_price + * Low Price of the aggregate offer. + * @type \Google\Shopping\Type\Price $high_price + * High Price of the aggregate offer. + * @type int|string $number_of_offers + * The number of aggregate offers. + * @type string $headline_offer_condition + * Condition of the headline offer. + * @type \Google\Shopping\Type\Price $headline_offer_price + * Headline Price of the aggregate offer. + * @type string $headline_offer_link + * Link to the headline offer. + * @type string $headline_offer_mobile_link + * Mobile Link to the headline offer. + * @type \Google\Shopping\Type\Price $headline_offer_shipping_price + * Headline Price of the aggregate offer. + * @type string $title + * Title of the item. + * @type string $image_link + * URL of an image of the item. + * @type array|\Google\Protobuf\Internal\RepeatedField $additional_image_links + * Additional URL of images of the item. + * @type string $description + * Description of the item. + * @type string $brand + * Product Related Attributes.[14-36] + * Brand of the item. + * @type string $mpn + * Manufacturer Part Number + * ([MPN](https://support.google.com/merchants/answer/188494#mpn)) of the + * item. + * @type string $gtin + * Global Trade Item Number + * ([GTIN](https://support.google.com/merchants/answer/188494#gtin)) of the + * item. + * @type array|\Google\Protobuf\Internal\RepeatedField $product_types + * Categories of the item (formatted as in [products data + * specification](https://support.google.com/merchants/answer/6324406)). + * @type string $google_product_category + * Google's category of the item (see [Google product + * taxonomy](https://support.google.com/merchants/answer/1705911)). When + * querying products, this field will contain the user provided value. There + * is currently no way to get back the auto assigned google product + * categories through the API. + * @type bool $adult + * Set to true if the item is targeted towards adults. + * @type int|string $multipack + * The number of identical products in a merchant-defined multipack. + * @type bool $is_bundle + * Whether the item is a merchant-defined bundle. A bundle is a custom + * grouping of different products sold by a merchant for a single price. + * @type string $age_group + * Target age group of the item. + * @type string $color + * Color of the item. + * @type string $gender + * Target gender of the item. + * @type string $material + * The material of which the item is made. + * @type string $pattern + * The item's pattern (e.g. polka dots). + * @type string $size + * Size of the item. Only one value is allowed. For variants with different + * sizes, insert a separate product for each size with the same + * `itemGroupId` value (see + * [https://support.google.com/merchants/answer/6324492](size definition)). + * @type string $size_system + * System in which the size is specified. Recommended for apparel items. + * @type array|\Google\Protobuf\Internal\RepeatedField $size_types + * The cut of the item. It can be used to represent combined size types for + * apparel items. Maximum two of size types can be provided (see + * [https://support.google.com/merchants/answer/6324497](size type)). + * @type string $item_group_id + * Shared identifier for all variants of the same product. + * @type array<\Google\Shopping\Css\V1\ProductDetail>|\Google\Protobuf\Internal\RepeatedField $product_details + * Technical specification or additional product details. + * @type \Google\Shopping\Css\V1\ProductWeight $product_weight + * The weight of the product in the units provided. The value must be + * between 0 (exclusive) and 2000 (inclusive). + * @type \Google\Shopping\Css\V1\ProductDimension $product_length + * The length of the product in the units provided. The value must be + * between 0 (exclusive) and 3000 (inclusive). + * @type \Google\Shopping\Css\V1\ProductDimension $product_width + * The width of the product in the units provided. The value must be between + * 0 (exclusive) and 3000 (inclusive). + * @type \Google\Shopping\Css\V1\ProductDimension $product_height + * The height of the product in the units provided. The value must be + * between + * 0 (exclusive) and 3000 (inclusive). + * @type array|\Google\Protobuf\Internal\RepeatedField $product_highlights + * Bullet points describing the most relevant highlights of a product. + * @type array<\Google\Shopping\Css\V1\Certification>|\Google\Protobuf\Internal\RepeatedField $certifications + * A list of certificates claimed by the CSS for the given product. + * @type \Google\Protobuf\Timestamp $expiration_date + * Date on which the item should expire, as specified upon insertion, in + * [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. The actual + * expiration date in Google Shopping is exposed in `productstatuses` as + * [googleExpirationDate](https://support.google.com/merchants/answer/6324499) + * and might be earlier if `expirationDate` is too far in the future. + * Note: It may take 2+ days from the expiration date for the item to + * actually get deleted. + * @type array|\Google\Protobuf\Internal\RepeatedField $included_destinations + * The list of destinations to include for this target (corresponds to + * checked check boxes in Merchant Center). Default destinations are always + * included unless provided in `excludedDestinations`. + * @type array|\Google\Protobuf\Internal\RepeatedField $excluded_destinations + * The list of destinations to exclude for this target (corresponds to + * unchecked check boxes in Merchant Center). + * @type string $pause + * Publication of this item will be temporarily paused. + * @type string $custom_label_0 + * Custom label 0 for custom grouping of items in a Shopping campaign. + * @type string $custom_label_1 + * Custom label 1 for custom grouping of items in a Shopping campaign. + * @type string $custom_label_2 + * Custom label 2 for custom grouping of items in a Shopping campaign. + * @type string $custom_label_3 + * Custom label 3 for custom grouping of items in a Shopping campaign. + * @type string $custom_label_4 + * Custom label 4 for custom grouping of items in a Shopping campaign. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * URL directly linking to your the Product Detail Page of the CSS. + * + * Generated from protobuf field optional string cpp_link = 1; + * @return string + */ + public function getCppLink() + { + return isset($this->cpp_link) ? $this->cpp_link : ''; + } + + public function hasCppLink() + { + return isset($this->cpp_link); + } + + public function clearCppLink() + { + unset($this->cpp_link); + } + + /** + * URL directly linking to your the Product Detail Page of the CSS. + * + * Generated from protobuf field optional string cpp_link = 1; + * @param string $var + * @return $this + */ + public function setCppLink($var) + { + GPBUtil::checkString($var, True); + $this->cpp_link = $var; + + return $this; + } + + /** + * URL for the mobile-optimized version of the Product Detail Page of the CSS. + * + * Generated from protobuf field optional string cpp_mobile_link = 2; + * @return string + */ + public function getCppMobileLink() + { + return isset($this->cpp_mobile_link) ? $this->cpp_mobile_link : ''; + } + + public function hasCppMobileLink() + { + return isset($this->cpp_mobile_link); + } + + public function clearCppMobileLink() + { + unset($this->cpp_mobile_link); + } + + /** + * URL for the mobile-optimized version of the Product Detail Page of the CSS. + * + * Generated from protobuf field optional string cpp_mobile_link = 2; + * @param string $var + * @return $this + */ + public function setCppMobileLink($var) + { + GPBUtil::checkString($var, True); + $this->cpp_mobile_link = $var; + + return $this; + } + + /** + * Allows advertisers to override the item URL when the product is shown + * within the context of Product Ads. + * + * Generated from protobuf field optional string cpp_ads_redirect = 42; + * @return string + */ + public function getCppAdsRedirect() + { + return isset($this->cpp_ads_redirect) ? $this->cpp_ads_redirect : ''; + } + + public function hasCppAdsRedirect() + { + return isset($this->cpp_ads_redirect); + } + + public function clearCppAdsRedirect() + { + unset($this->cpp_ads_redirect); + } + + /** + * Allows advertisers to override the item URL when the product is shown + * within the context of Product Ads. + * + * Generated from protobuf field optional string cpp_ads_redirect = 42; + * @param string $var + * @return $this + */ + public function setCppAdsRedirect($var) + { + GPBUtil::checkString($var, True); + $this->cpp_ads_redirect = $var; + + return $this; + } + + /** + * Low Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price low_price = 3; + * @return \Google\Shopping\Type\Price|null + */ + public function getLowPrice() + { + return $this->low_price; + } + + public function hasLowPrice() + { + return isset($this->low_price); + } + + public function clearLowPrice() + { + unset($this->low_price); + } + + /** + * Low Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price low_price = 3; + * @param \Google\Shopping\Type\Price $var + * @return $this + */ + public function setLowPrice($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class); + $this->low_price = $var; + + return $this; + } + + /** + * High Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price high_price = 4; + * @return \Google\Shopping\Type\Price|null + */ + public function getHighPrice() + { + return $this->high_price; + } + + public function hasHighPrice() + { + return isset($this->high_price); + } + + public function clearHighPrice() + { + unset($this->high_price); + } + + /** + * High Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price high_price = 4; + * @param \Google\Shopping\Type\Price $var + * @return $this + */ + public function setHighPrice($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class); + $this->high_price = $var; + + return $this; + } + + /** + * The number of aggregate offers. + * + * Generated from protobuf field optional int64 number_of_offers = 5; + * @return int|string + */ + public function getNumberOfOffers() + { + return isset($this->number_of_offers) ? $this->number_of_offers : 0; + } + + public function hasNumberOfOffers() + { + return isset($this->number_of_offers); + } + + public function clearNumberOfOffers() + { + unset($this->number_of_offers); + } + + /** + * The number of aggregate offers. + * + * Generated from protobuf field optional int64 number_of_offers = 5; + * @param int|string $var + * @return $this + */ + public function setNumberOfOffers($var) + { + GPBUtil::checkInt64($var); + $this->number_of_offers = $var; + + return $this; + } + + /** + * Condition of the headline offer. + * + * Generated from protobuf field optional string headline_offer_condition = 6; + * @return string + */ + public function getHeadlineOfferCondition() + { + return isset($this->headline_offer_condition) ? $this->headline_offer_condition : ''; + } + + public function hasHeadlineOfferCondition() + { + return isset($this->headline_offer_condition); + } + + public function clearHeadlineOfferCondition() + { + unset($this->headline_offer_condition); + } + + /** + * Condition of the headline offer. + * + * Generated from protobuf field optional string headline_offer_condition = 6; + * @param string $var + * @return $this + */ + public function setHeadlineOfferCondition($var) + { + GPBUtil::checkString($var, True); + $this->headline_offer_condition = $var; + + return $this; + } + + /** + * Headline Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price headline_offer_price = 7; + * @return \Google\Shopping\Type\Price|null + */ + public function getHeadlineOfferPrice() + { + return $this->headline_offer_price; + } + + public function hasHeadlineOfferPrice() + { + return isset($this->headline_offer_price); + } + + public function clearHeadlineOfferPrice() + { + unset($this->headline_offer_price); + } + + /** + * Headline Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price headline_offer_price = 7; + * @param \Google\Shopping\Type\Price $var + * @return $this + */ + public function setHeadlineOfferPrice($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class); + $this->headline_offer_price = $var; + + return $this; + } + + /** + * Link to the headline offer. + * + * Generated from protobuf field optional string headline_offer_link = 8; + * @return string + */ + public function getHeadlineOfferLink() + { + return isset($this->headline_offer_link) ? $this->headline_offer_link : ''; + } + + public function hasHeadlineOfferLink() + { + return isset($this->headline_offer_link); + } + + public function clearHeadlineOfferLink() + { + unset($this->headline_offer_link); + } + + /** + * Link to the headline offer. + * + * Generated from protobuf field optional string headline_offer_link = 8; + * @param string $var + * @return $this + */ + public function setHeadlineOfferLink($var) + { + GPBUtil::checkString($var, True); + $this->headline_offer_link = $var; + + return $this; + } + + /** + * Mobile Link to the headline offer. + * + * Generated from protobuf field optional string headline_offer_mobile_link = 9; + * @return string + */ + public function getHeadlineOfferMobileLink() + { + return isset($this->headline_offer_mobile_link) ? $this->headline_offer_mobile_link : ''; + } + + public function hasHeadlineOfferMobileLink() + { + return isset($this->headline_offer_mobile_link); + } + + public function clearHeadlineOfferMobileLink() + { + unset($this->headline_offer_mobile_link); + } + + /** + * Mobile Link to the headline offer. + * + * Generated from protobuf field optional string headline_offer_mobile_link = 9; + * @param string $var + * @return $this + */ + public function setHeadlineOfferMobileLink($var) + { + GPBUtil::checkString($var, True); + $this->headline_offer_mobile_link = $var; + + return $this; + } + + /** + * Headline Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price headline_offer_shipping_price = 41; + * @return \Google\Shopping\Type\Price|null + */ + public function getHeadlineOfferShippingPrice() + { + return $this->headline_offer_shipping_price; + } + + public function hasHeadlineOfferShippingPrice() + { + return isset($this->headline_offer_shipping_price); + } + + public function clearHeadlineOfferShippingPrice() + { + unset($this->headline_offer_shipping_price); + } + + /** + * Headline Price of the aggregate offer. + * + * Generated from protobuf field .google.shopping.type.Price headline_offer_shipping_price = 41; + * @param \Google\Shopping\Type\Price $var + * @return $this + */ + public function setHeadlineOfferShippingPrice($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Type\Price::class); + $this->headline_offer_shipping_price = $var; + + return $this; + } + + /** + * Title of the item. + * + * Generated from protobuf field optional string title = 10; + * @return string + */ + public function getTitle() + { + return isset($this->title) ? $this->title : ''; + } + + public function hasTitle() + { + return isset($this->title); + } + + public function clearTitle() + { + unset($this->title); + } + + /** + * Title of the item. + * + * Generated from protobuf field optional string title = 10; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * URL of an image of the item. + * + * Generated from protobuf field optional string image_link = 11; + * @return string + */ + public function getImageLink() + { + return isset($this->image_link) ? $this->image_link : ''; + } + + public function hasImageLink() + { + return isset($this->image_link); + } + + public function clearImageLink() + { + unset($this->image_link); + } + + /** + * URL of an image of the item. + * + * Generated from protobuf field optional string image_link = 11; + * @param string $var + * @return $this + */ + public function setImageLink($var) + { + GPBUtil::checkString($var, True); + $this->image_link = $var; + + return $this; + } + + /** + * Additional URL of images of the item. + * + * Generated from protobuf field repeated string additional_image_links = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdditionalImageLinks() + { + return $this->additional_image_links; + } + + /** + * Additional URL of images of the item. + * + * Generated from protobuf field repeated string additional_image_links = 12; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdditionalImageLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->additional_image_links = $arr; + + return $this; + } + + /** + * Description of the item. + * + * Generated from protobuf field optional string description = 13; + * @return string + */ + public function getDescription() + { + return isset($this->description) ? $this->description : ''; + } + + public function hasDescription() + { + return isset($this->description); + } + + public function clearDescription() + { + unset($this->description); + } + + /** + * Description of the item. + * + * Generated from protobuf field optional string description = 13; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Product Related Attributes.[14-36] + * Brand of the item. + * + * Generated from protobuf field optional string brand = 14; + * @return string + */ + public function getBrand() + { + return isset($this->brand) ? $this->brand : ''; + } + + public function hasBrand() + { + return isset($this->brand); + } + + public function clearBrand() + { + unset($this->brand); + } + + /** + * Product Related Attributes.[14-36] + * Brand of the item. + * + * Generated from protobuf field optional string brand = 14; + * @param string $var + * @return $this + */ + public function setBrand($var) + { + GPBUtil::checkString($var, True); + $this->brand = $var; + + return $this; + } + + /** + * Manufacturer Part Number + * ([MPN](https://support.google.com/merchants/answer/188494#mpn)) of the + * item. + * + * Generated from protobuf field optional string mpn = 15; + * @return string + */ + public function getMpn() + { + return isset($this->mpn) ? $this->mpn : ''; + } + + public function hasMpn() + { + return isset($this->mpn); + } + + public function clearMpn() + { + unset($this->mpn); + } + + /** + * Manufacturer Part Number + * ([MPN](https://support.google.com/merchants/answer/188494#mpn)) of the + * item. + * + * Generated from protobuf field optional string mpn = 15; + * @param string $var + * @return $this + */ + public function setMpn($var) + { + GPBUtil::checkString($var, True); + $this->mpn = $var; + + return $this; + } + + /** + * Global Trade Item Number + * ([GTIN](https://support.google.com/merchants/answer/188494#gtin)) of the + * item. + * + * Generated from protobuf field optional string gtin = 16; + * @return string + */ + public function getGtin() + { + return isset($this->gtin) ? $this->gtin : ''; + } + + public function hasGtin() + { + return isset($this->gtin); + } + + public function clearGtin() + { + unset($this->gtin); + } + + /** + * Global Trade Item Number + * ([GTIN](https://support.google.com/merchants/answer/188494#gtin)) of the + * item. + * + * Generated from protobuf field optional string gtin = 16; + * @param string $var + * @return $this + */ + public function setGtin($var) + { + GPBUtil::checkString($var, True); + $this->gtin = $var; + + return $this; + } + + /** + * Categories of the item (formatted as in [products data + * specification](https://support.google.com/merchants/answer/6324406)). + * + * Generated from protobuf field repeated string product_types = 36; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductTypes() + { + return $this->product_types; + } + + /** + * Categories of the item (formatted as in [products data + * specification](https://support.google.com/merchants/answer/6324406)). + * + * Generated from protobuf field repeated string product_types = 36; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_types = $arr; + + return $this; + } + + /** + * Google's category of the item (see [Google product + * taxonomy](https://support.google.com/merchants/answer/1705911)). When + * querying products, this field will contain the user provided value. There + * is currently no way to get back the auto assigned google product + * categories through the API. + * + * Generated from protobuf field optional string google_product_category = 17; + * @return string + */ + public function getGoogleProductCategory() + { + return isset($this->google_product_category) ? $this->google_product_category : ''; + } + + public function hasGoogleProductCategory() + { + return isset($this->google_product_category); + } + + public function clearGoogleProductCategory() + { + unset($this->google_product_category); + } + + /** + * Google's category of the item (see [Google product + * taxonomy](https://support.google.com/merchants/answer/1705911)). When + * querying products, this field will contain the user provided value. There + * is currently no way to get back the auto assigned google product + * categories through the API. + * + * Generated from protobuf field optional string google_product_category = 17; + * @param string $var + * @return $this + */ + public function setGoogleProductCategory($var) + { + GPBUtil::checkString($var, True); + $this->google_product_category = $var; + + return $this; + } + + /** + * Set to true if the item is targeted towards adults. + * + * Generated from protobuf field optional bool adult = 18; + * @return bool + */ + public function getAdult() + { + return isset($this->adult) ? $this->adult : false; + } + + public function hasAdult() + { + return isset($this->adult); + } + + public function clearAdult() + { + unset($this->adult); + } + + /** + * Set to true if the item is targeted towards adults. + * + * Generated from protobuf field optional bool adult = 18; + * @param bool $var + * @return $this + */ + public function setAdult($var) + { + GPBUtil::checkBool($var); + $this->adult = $var; + + return $this; + } + + /** + * The number of identical products in a merchant-defined multipack. + * + * Generated from protobuf field optional int64 multipack = 19; + * @return int|string + */ + public function getMultipack() + { + return isset($this->multipack) ? $this->multipack : 0; + } + + public function hasMultipack() + { + return isset($this->multipack); + } + + public function clearMultipack() + { + unset($this->multipack); + } + + /** + * The number of identical products in a merchant-defined multipack. + * + * Generated from protobuf field optional int64 multipack = 19; + * @param int|string $var + * @return $this + */ + public function setMultipack($var) + { + GPBUtil::checkInt64($var); + $this->multipack = $var; + + return $this; + } + + /** + * Whether the item is a merchant-defined bundle. A bundle is a custom + * grouping of different products sold by a merchant for a single price. + * + * Generated from protobuf field optional bool is_bundle = 20; + * @return bool + */ + public function getIsBundle() + { + return isset($this->is_bundle) ? $this->is_bundle : false; + } + + public function hasIsBundle() + { + return isset($this->is_bundle); + } + + public function clearIsBundle() + { + unset($this->is_bundle); + } + + /** + * Whether the item is a merchant-defined bundle. A bundle is a custom + * grouping of different products sold by a merchant for a single price. + * + * Generated from protobuf field optional bool is_bundle = 20; + * @param bool $var + * @return $this + */ + public function setIsBundle($var) + { + GPBUtil::checkBool($var); + $this->is_bundle = $var; + + return $this; + } + + /** + * Target age group of the item. + * + * Generated from protobuf field optional string age_group = 21; + * @return string + */ + public function getAgeGroup() + { + return isset($this->age_group) ? $this->age_group : ''; + } + + public function hasAgeGroup() + { + return isset($this->age_group); + } + + public function clearAgeGroup() + { + unset($this->age_group); + } + + /** + * Target age group of the item. + * + * Generated from protobuf field optional string age_group = 21; + * @param string $var + * @return $this + */ + public function setAgeGroup($var) + { + GPBUtil::checkString($var, True); + $this->age_group = $var; + + return $this; + } + + /** + * Color of the item. + * + * Generated from protobuf field optional string color = 22; + * @return string + */ + public function getColor() + { + return isset($this->color) ? $this->color : ''; + } + + public function hasColor() + { + return isset($this->color); + } + + public function clearColor() + { + unset($this->color); + } + + /** + * Color of the item. + * + * Generated from protobuf field optional string color = 22; + * @param string $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkString($var, True); + $this->color = $var; + + return $this; + } + + /** + * Target gender of the item. + * + * Generated from protobuf field optional string gender = 23; + * @return string + */ + public function getGender() + { + return isset($this->gender) ? $this->gender : ''; + } + + public function hasGender() + { + return isset($this->gender); + } + + public function clearGender() + { + unset($this->gender); + } + + /** + * Target gender of the item. + * + * Generated from protobuf field optional string gender = 23; + * @param string $var + * @return $this + */ + public function setGender($var) + { + GPBUtil::checkString($var, True); + $this->gender = $var; + + return $this; + } + + /** + * The material of which the item is made. + * + * Generated from protobuf field optional string material = 24; + * @return string + */ + public function getMaterial() + { + return isset($this->material) ? $this->material : ''; + } + + public function hasMaterial() + { + return isset($this->material); + } + + public function clearMaterial() + { + unset($this->material); + } + + /** + * The material of which the item is made. + * + * Generated from protobuf field optional string material = 24; + * @param string $var + * @return $this + */ + public function setMaterial($var) + { + GPBUtil::checkString($var, True); + $this->material = $var; + + return $this; + } + + /** + * The item's pattern (e.g. polka dots). + * + * Generated from protobuf field optional string pattern = 25; + * @return string + */ + public function getPattern() + { + return isset($this->pattern) ? $this->pattern : ''; + } + + public function hasPattern() + { + return isset($this->pattern); + } + + public function clearPattern() + { + unset($this->pattern); + } + + /** + * The item's pattern (e.g. polka dots). + * + * Generated from protobuf field optional string pattern = 25; + * @param string $var + * @return $this + */ + public function setPattern($var) + { + GPBUtil::checkString($var, True); + $this->pattern = $var; + + return $this; + } + + /** + * Size of the item. Only one value is allowed. For variants with different + * sizes, insert a separate product for each size with the same + * `itemGroupId` value (see + * [https://support.google.com/merchants/answer/6324492](size definition)). + * + * Generated from protobuf field optional string size = 26; + * @return string + */ + public function getSize() + { + return isset($this->size) ? $this->size : ''; + } + + public function hasSize() + { + return isset($this->size); + } + + public function clearSize() + { + unset($this->size); + } + + /** + * Size of the item. Only one value is allowed. For variants with different + * sizes, insert a separate product for each size with the same + * `itemGroupId` value (see + * [https://support.google.com/merchants/answer/6324492](size definition)). + * + * Generated from protobuf field optional string size = 26; + * @param string $var + * @return $this + */ + public function setSize($var) + { + GPBUtil::checkString($var, True); + $this->size = $var; + + return $this; + } + + /** + * System in which the size is specified. Recommended for apparel items. + * + * Generated from protobuf field optional string size_system = 27; + * @return string + */ + public function getSizeSystem() + { + return isset($this->size_system) ? $this->size_system : ''; + } + + public function hasSizeSystem() + { + return isset($this->size_system); + } + + public function clearSizeSystem() + { + unset($this->size_system); + } + + /** + * System in which the size is specified. Recommended for apparel items. + * + * Generated from protobuf field optional string size_system = 27; + * @param string $var + * @return $this + */ + public function setSizeSystem($var) + { + GPBUtil::checkString($var, True); + $this->size_system = $var; + + return $this; + } + + /** + * The cut of the item. It can be used to represent combined size types for + * apparel items. Maximum two of size types can be provided (see + * [https://support.google.com/merchants/answer/6324497](size type)). + * + * Generated from protobuf field repeated string size_types = 28; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSizeTypes() + { + return $this->size_types; + } + + /** + * The cut of the item. It can be used to represent combined size types for + * apparel items. Maximum two of size types can be provided (see + * [https://support.google.com/merchants/answer/6324497](size type)). + * + * Generated from protobuf field repeated string size_types = 28; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSizeTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->size_types = $arr; + + return $this; + } + + /** + * Shared identifier for all variants of the same product. + * + * Generated from protobuf field optional string item_group_id = 29; + * @return string + */ + public function getItemGroupId() + { + return isset($this->item_group_id) ? $this->item_group_id : ''; + } + + public function hasItemGroupId() + { + return isset($this->item_group_id); + } + + public function clearItemGroupId() + { + unset($this->item_group_id); + } + + /** + * Shared identifier for all variants of the same product. + * + * Generated from protobuf field optional string item_group_id = 29; + * @param string $var + * @return $this + */ + public function setItemGroupId($var) + { + GPBUtil::checkString($var, True); + $this->item_group_id = $var; + + return $this; + } + + /** + * Technical specification or additional product details. + * + * Generated from protobuf field repeated .google.shopping.css.v1.ProductDetail product_details = 30; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductDetails() + { + return $this->product_details; + } + + /** + * Technical specification or additional product details. + * + * Generated from protobuf field repeated .google.shopping.css.v1.ProductDetail product_details = 30; + * @param array<\Google\Shopping\Css\V1\ProductDetail>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductDetails($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\ProductDetail::class); + $this->product_details = $arr; + + return $this; + } + + /** + * The weight of the product in the units provided. The value must be + * between 0 (exclusive) and 2000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductWeight product_weight = 31; + * @return \Google\Shopping\Css\V1\ProductWeight|null + */ + public function getProductWeight() + { + return $this->product_weight; + } + + public function hasProductWeight() + { + return isset($this->product_weight); + } + + public function clearProductWeight() + { + unset($this->product_weight); + } + + /** + * The weight of the product in the units provided. The value must be + * between 0 (exclusive) and 2000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductWeight product_weight = 31; + * @param \Google\Shopping\Css\V1\ProductWeight $var + * @return $this + */ + public function setProductWeight($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\ProductWeight::class); + $this->product_weight = $var; + + return $this; + } + + /** + * The length of the product in the units provided. The value must be + * between 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_length = 32; + * @return \Google\Shopping\Css\V1\ProductDimension|null + */ + public function getProductLength() + { + return $this->product_length; + } + + public function hasProductLength() + { + return isset($this->product_length); + } + + public function clearProductLength() + { + unset($this->product_length); + } + + /** + * The length of the product in the units provided. The value must be + * between 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_length = 32; + * @param \Google\Shopping\Css\V1\ProductDimension $var + * @return $this + */ + public function setProductLength($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\ProductDimension::class); + $this->product_length = $var; + + return $this; + } + + /** + * The width of the product in the units provided. The value must be between + * 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_width = 33; + * @return \Google\Shopping\Css\V1\ProductDimension|null + */ + public function getProductWidth() + { + return $this->product_width; + } + + public function hasProductWidth() + { + return isset($this->product_width); + } + + public function clearProductWidth() + { + unset($this->product_width); + } + + /** + * The width of the product in the units provided. The value must be between + * 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_width = 33; + * @param \Google\Shopping\Css\V1\ProductDimension $var + * @return $this + */ + public function setProductWidth($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\ProductDimension::class); + $this->product_width = $var; + + return $this; + } + + /** + * The height of the product in the units provided. The value must be + * between + * 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_height = 34; + * @return \Google\Shopping\Css\V1\ProductDimension|null + */ + public function getProductHeight() + { + return $this->product_height; + } + + public function hasProductHeight() + { + return isset($this->product_height); + } + + public function clearProductHeight() + { + unset($this->product_height); + } + + /** + * The height of the product in the units provided. The value must be + * between + * 0 (exclusive) and 3000 (inclusive). + * + * Generated from protobuf field .google.shopping.css.v1.ProductDimension product_height = 34; + * @param \Google\Shopping\Css\V1\ProductDimension $var + * @return $this + */ + public function setProductHeight($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\ProductDimension::class); + $this->product_height = $var; + + return $this; + } + + /** + * Bullet points describing the most relevant highlights of a product. + * + * Generated from protobuf field repeated string product_highlights = 35; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProductHighlights() + { + return $this->product_highlights; + } + + /** + * Bullet points describing the most relevant highlights of a product. + * + * Generated from protobuf field repeated string product_highlights = 35; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProductHighlights($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->product_highlights = $arr; + + return $this; + } + + /** + * A list of certificates claimed by the CSS for the given product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.Certification certifications = 39; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCertifications() + { + return $this->certifications; + } + + /** + * A list of certificates claimed by the CSS for the given product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.Certification certifications = 39; + * @param array<\Google\Shopping\Css\V1\Certification>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCertifications($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\Certification::class); + $this->certifications = $arr; + + return $this; + } + + /** + * Date on which the item should expire, as specified upon insertion, in + * [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. The actual + * expiration date in Google Shopping is exposed in `productstatuses` as + * [googleExpirationDate](https://support.google.com/merchants/answer/6324499) + * and might be earlier if `expirationDate` is too far in the future. + * Note: It may take 2+ days from the expiration date for the item to + * actually get deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_date = 40; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpirationDate() + { + return $this->expiration_date; + } + + public function hasExpirationDate() + { + return isset($this->expiration_date); + } + + public function clearExpirationDate() + { + unset($this->expiration_date); + } + + /** + * Date on which the item should expire, as specified upon insertion, in + * [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. The actual + * expiration date in Google Shopping is exposed in `productstatuses` as + * [googleExpirationDate](https://support.google.com/merchants/answer/6324499) + * and might be earlier if `expirationDate` is too far in the future. + * Note: It may take 2+ days from the expiration date for the item to + * actually get deleted. + * + * Generated from protobuf field .google.protobuf.Timestamp expiration_date = 40; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpirationDate($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiration_date = $var; + + return $this; + } + + /** + * The list of destinations to include for this target (corresponds to + * checked check boxes in Merchant Center). Default destinations are always + * included unless provided in `excludedDestinations`. + * + * Generated from protobuf field repeated string included_destinations = 43; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIncludedDestinations() + { + return $this->included_destinations; + } + + /** + * The list of destinations to include for this target (corresponds to + * checked check boxes in Merchant Center). Default destinations are always + * included unless provided in `excludedDestinations`. + * + * Generated from protobuf field repeated string included_destinations = 43; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIncludedDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->included_destinations = $arr; + + return $this; + } + + /** + * The list of destinations to exclude for this target (corresponds to + * unchecked check boxes in Merchant Center). + * + * Generated from protobuf field repeated string excluded_destinations = 44; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExcludedDestinations() + { + return $this->excluded_destinations; + } + + /** + * The list of destinations to exclude for this target (corresponds to + * unchecked check boxes in Merchant Center). + * + * Generated from protobuf field repeated string excluded_destinations = 44; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExcludedDestinations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->excluded_destinations = $arr; + + return $this; + } + + /** + * Publication of this item will be temporarily paused. + * + * Generated from protobuf field optional string pause = 45; + * @return string + */ + public function getPause() + { + return isset($this->pause) ? $this->pause : ''; + } + + public function hasPause() + { + return isset($this->pause); + } + + public function clearPause() + { + unset($this->pause); + } + + /** + * Publication of this item will be temporarily paused. + * + * Generated from protobuf field optional string pause = 45; + * @param string $var + * @return $this + */ + public function setPause($var) + { + GPBUtil::checkString($var, True); + $this->pause = $var; + + return $this; + } + + /** + * Custom label 0 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_0 = 46; + * @return string + */ + public function getCustomLabel0() + { + return isset($this->custom_label_0) ? $this->custom_label_0 : ''; + } + + public function hasCustomLabel0() + { + return isset($this->custom_label_0); + } + + public function clearCustomLabel0() + { + unset($this->custom_label_0); + } + + /** + * Custom label 0 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_0 = 46; + * @param string $var + * @return $this + */ + public function setCustomLabel0($var) + { + GPBUtil::checkString($var, True); + $this->custom_label_0 = $var; + + return $this; + } + + /** + * Custom label 1 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_1 = 47; + * @return string + */ + public function getCustomLabel1() + { + return isset($this->custom_label_1) ? $this->custom_label_1 : ''; + } + + public function hasCustomLabel1() + { + return isset($this->custom_label_1); + } + + public function clearCustomLabel1() + { + unset($this->custom_label_1); + } + + /** + * Custom label 1 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_1 = 47; + * @param string $var + * @return $this + */ + public function setCustomLabel1($var) + { + GPBUtil::checkString($var, True); + $this->custom_label_1 = $var; + + return $this; + } + + /** + * Custom label 2 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_2 = 48; + * @return string + */ + public function getCustomLabel2() + { + return isset($this->custom_label_2) ? $this->custom_label_2 : ''; + } + + public function hasCustomLabel2() + { + return isset($this->custom_label_2); + } + + public function clearCustomLabel2() + { + unset($this->custom_label_2); + } + + /** + * Custom label 2 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_2 = 48; + * @param string $var + * @return $this + */ + public function setCustomLabel2($var) + { + GPBUtil::checkString($var, True); + $this->custom_label_2 = $var; + + return $this; + } + + /** + * Custom label 3 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_3 = 49; + * @return string + */ + public function getCustomLabel3() + { + return isset($this->custom_label_3) ? $this->custom_label_3 : ''; + } + + public function hasCustomLabel3() + { + return isset($this->custom_label_3); + } + + public function clearCustomLabel3() + { + unset($this->custom_label_3); + } + + /** + * Custom label 3 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_3 = 49; + * @param string $var + * @return $this + */ + public function setCustomLabel3($var) + { + GPBUtil::checkString($var, True); + $this->custom_label_3 = $var; + + return $this; + } + + /** + * Custom label 4 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_4 = 50; + * @return string + */ + public function getCustomLabel4() + { + return isset($this->custom_label_4) ? $this->custom_label_4 : ''; + } + + public function hasCustomLabel4() + { + return isset($this->custom_label_4); + } + + public function clearCustomLabel4() + { + unset($this->custom_label_4); + } + + /** + * Custom label 4 for custom grouping of items in a Shopping campaign. + * + * Generated from protobuf field optional string custom_label_4 = 50; + * @param string $var + * @return $this + */ + public function setCustomLabel4($var) + { + GPBUtil::checkString($var, True); + $this->custom_label_4 = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/Certification.php b/ShoppingCss/src/V1/Certification.php new file mode 100644 index 000000000000..adfb3500d34e --- /dev/null +++ b/ShoppingCss/src/V1/Certification.php @@ -0,0 +1,135 @@ +google.shopping.css.v1.Certification + */ +class Certification extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the certification. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Name of the certification body. + * + * Generated from protobuf field string authority = 2; + */ + protected $authority = ''; + /** + * A unique code to identify the certification. + * + * Generated from protobuf field string code = 3; + */ + protected $code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the certification. + * @type string $authority + * Name of the certification body. + * @type string $code + * A unique code to identify the certification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * Name of the certification. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the certification. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Name of the certification body. + * + * Generated from protobuf field string authority = 2; + * @return string + */ + public function getAuthority() + { + return $this->authority; + } + + /** + * Name of the certification body. + * + * Generated from protobuf field string authority = 2; + * @param string $var + * @return $this + */ + public function setAuthority($var) + { + GPBUtil::checkString($var, True); + $this->authority = $var; + + return $this; + } + + /** + * A unique code to identify the certification. + * + * Generated from protobuf field string code = 3; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * A unique code to identify the certification. + * + * Generated from protobuf field string code = 3; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/Client/AccountLabelsServiceClient.php b/ShoppingCss/src/V1/Client/AccountLabelsServiceClient.php new file mode 100644 index 000000000000..60ebb906dcf1 --- /dev/null +++ b/ShoppingCss/src/V1/Client/AccountLabelsServiceClient.php @@ -0,0 +1,335 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/account_labels_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/account_labels_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/account_labels_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/account_labels_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. + */ + 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 + * account_label resource. + * + * @param string $account + * @param string $label + * + * @return string The formatted account_label resource. + */ + public static function accountLabelName(string $account, string $label): string + { + return self::getPathTemplate('accountLabel')->render([ + 'account' => $account, + 'label' => $label, + ]); + } + + /** + * 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} + * - accountLabel: accounts/{account}/labels/{label} + * + * 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. + */ + 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 'css.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. + * } + * + * @throws ValidationException + */ + 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); + } + + /** + * Creates a new label, not assigned to any account. + * + * The async variant is + * {@see AccountLabelsServiceClient::createAccountLabelAsync()} . + * + * @example samples/V1/AccountLabelsServiceClient/create_account_label.php + * + * @param CreateAccountLabelRequest $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 AccountLabel + * + * @throws ApiException Thrown if the API call fails. + */ + public function createAccountLabel(CreateAccountLabelRequest $request, array $callOptions = []): AccountLabel + { + return $this->startApiCall('CreateAccountLabel', $request, $callOptions)->wait(); + } + + /** + * Deletes a label and removes it from all accounts to which it was assigned. + * + * The async variant is + * {@see AccountLabelsServiceClient::deleteAccountLabelAsync()} . + * + * @example samples/V1/AccountLabelsServiceClient/delete_account_label.php + * + * @param DeleteAccountLabelRequest $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. + */ + public function deleteAccountLabel(DeleteAccountLabelRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteAccountLabel', $request, $callOptions)->wait(); + } + + /** + * Lists the labels assigned to an account. + * + * The async variant is {@see AccountLabelsServiceClient::listAccountLabelsAsync()} + * . + * + * @example samples/V1/AccountLabelsServiceClient/list_account_labels.php + * + * @param ListAccountLabelsRequest $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. + */ + public function listAccountLabels(ListAccountLabelsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAccountLabels', $request, $callOptions); + } + + /** + * Updates a label. + * + * The async variant is + * {@see AccountLabelsServiceClient::updateAccountLabelAsync()} . + * + * @example samples/V1/AccountLabelsServiceClient/update_account_label.php + * + * @param UpdateAccountLabelRequest $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 AccountLabel + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateAccountLabel(UpdateAccountLabelRequest $request, array $callOptions = []): AccountLabel + { + return $this->startApiCall('UpdateAccountLabel', $request, $callOptions)->wait(); + } +} diff --git a/ShoppingCss/src/V1/Client/AccountsServiceClient.php b/ShoppingCss/src/V1/Client/AccountsServiceClient.php new file mode 100644 index 000000000000..5cbcec034c16 --- /dev/null +++ b/ShoppingCss/src/V1/Client/AccountsServiceClient.php @@ -0,0 +1,288 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/accounts_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/accounts_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/accounts_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/accounts_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. + */ + public static function accountName(string $account): string + { + return self::getPathTemplate('account')->render([ + 'account' => $account, + ]); + } + + /** + * 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} + * + * 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. + */ + 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 'css.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. + * } + * + * @throws ValidationException + */ + 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); + } + + /** + * Retrieves a single CSS/MC account by ID. + * + * The async variant is {@see AccountsServiceClient::getAccountAsync()} . + * + * @example samples/V1/AccountsServiceClient/get_account.php + * + * @param GetAccountRequest $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 Account + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAccount(GetAccountRequest $request, array $callOptions = []): Account + { + return $this->startApiCall('GetAccount', $request, $callOptions)->wait(); + } + + /** + * Lists all the accounts under the specified CSS account ID, and + * optionally filters by label ID and account name. + * + * The async variant is {@see AccountsServiceClient::listChildAccountsAsync()} . + * + * @example samples/V1/AccountsServiceClient/list_child_accounts.php + * + * @param ListChildAccountsRequest $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. + */ + public function listChildAccounts(ListChildAccountsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListChildAccounts', $request, $callOptions); + } + + /** + * Updates labels assigned to CSS/MC accounts by a CSS domain. + * + * The async variant is {@see AccountsServiceClient::updateLabelsAsync()} . + * + * @example samples/V1/AccountsServiceClient/update_labels.php + * + * @param UpdateAccountLabelsRequest $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 Account + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateLabels(UpdateAccountLabelsRequest $request, array $callOptions = []): Account + { + return $this->startApiCall('UpdateLabels', $request, $callOptions)->wait(); + } +} diff --git a/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php b/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php new file mode 100644 index 000000000000..29d605d1c6f5 --- /dev/null +++ b/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php @@ -0,0 +1,288 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/css_product_inputs_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/css_product_inputs_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/css_product_inputs_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . '/../resources/css_product_inputs_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. + */ + 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 + * css_product_input resource. + * + * @param string $account + * @param string $cssProductInput + * + * @return string The formatted css_product_input resource. + */ + public static function cssProductInputName(string $account, string $cssProductInput): string + { + return self::getPathTemplate('cssProductInput')->render([ + 'account' => $account, + 'css_product_input' => $cssProductInput, + ]); + } + + /** + * 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} + * - cssProductInput: accounts/{account}/cssProductInputs/{css_product_input} + * + * 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. + */ + 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 'css.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. + * } + * + * @throws ValidationException + */ + 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 CSS Product input from your CSS Center account. + * + * After a delete it may take several minutes until the input is no longer + * available. + * + * The async variant is + * {@see CssProductInputsServiceClient::deleteCssProductInputAsync()} . + * + * @example samples/V1/CssProductInputsServiceClient/delete_css_product_input.php + * + * @param DeleteCssProductInputRequest $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. + */ + public function deleteCssProductInput(DeleteCssProductInputRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteCssProductInput', $request, $callOptions)->wait(); + } + + /** + * Uploads a CssProductInput to your CSS Center account. If an + * input with the same contentLanguage, identity, feedLabel and feedId already + * exists, this method replaces that entry. + * + * After inserting, updating, or deleting a CSS Product input, it may + * take several minutes before the processed CSS Product can be retrieved. + * + * The async variant is + * {@see CssProductInputsServiceClient::insertCssProductInputAsync()} . + * + * @example samples/V1/CssProductInputsServiceClient/insert_css_product_input.php + * + * @param InsertCssProductInputRequest $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 CssProductInput + * + * @throws ApiException Thrown if the API call fails. + */ + public function insertCssProductInput( + InsertCssProductInputRequest $request, + array $callOptions = [] + ): CssProductInput { + return $this->startApiCall('InsertCssProductInput', $request, $callOptions)->wait(); + } +} diff --git a/ShoppingCss/src/V1/Client/CssProductsServiceClient.php b/ShoppingCss/src/V1/Client/CssProductsServiceClient.php new file mode 100644 index 000000000000..d162c4ba1b2f --- /dev/null +++ b/ShoppingCss/src/V1/Client/CssProductsServiceClient.php @@ -0,0 +1,286 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/css_products_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/css_products_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/css_products_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/css_products_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. + */ + 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 css_product + * resource. + * + * @param string $account + * @param string $cssProduct + * + * @return string The formatted css_product resource. + */ + public static function cssProductName(string $account, string $cssProduct): string + { + return self::getPathTemplate('cssProduct')->render([ + 'account' => $account, + 'css_product' => $cssProduct, + ]); + } + + /** + * 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} + * - cssProduct: accounts/{account}/cssProducts/{css_product} + * + * 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. + */ + 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 'css.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. + * } + * + * @throws ValidationException + */ + 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); + } + + /** + * Retrieves the processed CSS Product from your CSS Center account. After + * inserting, updating, or deleting a product input, it may take several + * minutes before the updated final product can be retrieved. + * + * The async variant is {@see CssProductsServiceClient::getCssProductAsync()} . + * + * @example samples/V1/CssProductsServiceClient/get_css_product.php + * + * @param GetCssProductRequest $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 CssProduct + * + * @throws ApiException Thrown if the API call fails. + */ + public function getCssProduct(GetCssProductRequest $request, array $callOptions = []): CssProduct + { + return $this->startApiCall('GetCssProduct', $request, $callOptions)->wait(); + } + + /** + * Lists the processed CSS Products in your CSS Center account. The response + * might contain fewer items than specified by pageSize. Rely on pageToken to + * determine if there are more items to be requested. + * + * After inserting, updating, or deleting a CSS product input, it may + * take several minutes before the updated processed CSS product can be + * retrieved. + * + * The async variant is {@see CssProductsServiceClient::listCssProductsAsync()} . + * + * @example samples/V1/CssProductsServiceClient/list_css_products.php + * + * @param ListCssProductsRequest $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. + */ + public function listCssProducts(ListCssProductsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListCssProducts', $request, $callOptions); + } +} diff --git a/ShoppingCss/src/V1/CreateAccountLabelRequest.php b/ShoppingCss/src/V1/CreateAccountLabelRequest.php new file mode 100644 index 000000000000..12a37d6ff574 --- /dev/null +++ b/ShoppingCss/src/V1/CreateAccountLabelRequest.php @@ -0,0 +1,132 @@ +google.shopping.css.v1.CreateAccountLabelRequest + */ +class CreateAccountLabelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent account. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The label to create. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel account_label = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $account_label = null; + + /** + * @param string $parent Required. The parent account. + * Format: accounts/{account} + * Please see {@see AccountLabelsServiceClient::accountName()} for help formatting this field. + * @param \Google\Shopping\Css\V1\AccountLabel $accountLabel Required. The label to create. + * + * @return \Google\Shopping\Css\V1\CreateAccountLabelRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Shopping\Css\V1\AccountLabel $accountLabel): self + { + return (new self()) + ->setParent($parent) + ->setAccountLabel($accountLabel); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent account. + * Format: accounts/{account} + * @type \Google\Shopping\Css\V1\AccountLabel $account_label + * Required. The label to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\AccountsLabels::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent account. + * 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 parent account. + * 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; + } + + /** + * Required. The label to create. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel account_label = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Css\V1\AccountLabel|null + */ + public function getAccountLabel() + { + return $this->account_label; + } + + public function hasAccountLabel() + { + return isset($this->account_label); + } + + public function clearAccountLabel() + { + unset($this->account_label); + } + + /** + * Required. The label to create. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel account_label = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Css\V1\AccountLabel $var + * @return $this + */ + public function setAccountLabel($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\AccountLabel::class); + $this->account_label = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/CssProduct.php b/ShoppingCss/src/V1/CssProduct.php new file mode 100644 index 000000000000..768f8e9b3bdb --- /dev/null +++ b/ShoppingCss/src/V1/CssProduct.php @@ -0,0 +1,331 @@ +google.shopping.css.v1.CssProduct + */ +class CssProduct extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the CSS Product. + * Format: + * `"accounts/{account}/cssProducts/{css_product}"` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. Your unique raw identifier for the product. + * + * Generated from protobuf field string raw_provided_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $raw_provided_id = ''; + /** + * Output only. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the + * product. + * + * Generated from protobuf field string content_language = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $content_language = ''; + /** + * Output only. The feed label for the product. + * + * Generated from protobuf field string feed_label = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $feed_label = ''; + /** + * Output only. A list of product attributes. + * + * Generated from protobuf field .google.shopping.css.v1.Attributes attributes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $attributes = null; + /** + * Output only. A list of custom (CSS-provided) attributes. It can also be + * used to submit any attribute of the feed 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 additional attributes used for Buy on Google. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $custom_attributes; + /** + * Output only. The status of a product, data validation issues, that is, + * information about a product computed asynchronously. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductStatus css_product_status = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $css_product_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the CSS Product. + * Format: + * `"accounts/{account}/cssProducts/{css_product}"` + * @type string $raw_provided_id + * Output only. Your unique raw identifier for the product. + * @type string $content_language + * Output only. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the + * product. + * @type string $feed_label + * Output only. The feed label for the product. + * @type \Google\Shopping\Css\V1\Attributes $attributes + * Output only. A list of product attributes. + * @type array<\Google\Shopping\Type\CustomAttribute>|\Google\Protobuf\Internal\RepeatedField $custom_attributes + * Output only. A list of custom (CSS-provided) attributes. It can also be + * used to submit any attribute of the feed 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 additional attributes used for Buy on Google. + * @type \Google\Shopping\Css\V1\CssProductStatus $css_product_status + * Output only. The status of a product, data validation issues, that is, + * information about a product computed asynchronously. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProducts::initOnce(); + parent::__construct($data); + } + + /** + * The name of the CSS Product. + * Format: + * `"accounts/{account}/cssProducts/{css_product}"` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the CSS Product. + * Format: + * `"accounts/{account}/cssProducts/{css_product}"` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. Your unique raw identifier for the product. + * + * Generated from protobuf field string raw_provided_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRawProvidedId() + { + return $this->raw_provided_id; + } + + /** + * Output only. Your unique raw identifier for the product. + * + * Generated from protobuf field string raw_provided_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRawProvidedId($var) + { + GPBUtil::checkString($var, True); + $this->raw_provided_id = $var; + + return $this; + } + + /** + * Output only. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the + * product. + * + * Generated from protobuf field string content_language = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getContentLanguage() + { + return $this->content_language; + } + + /** + * Output only. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the + * product. + * + * Generated from protobuf field string content_language = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setContentLanguage($var) + { + GPBUtil::checkString($var, True); + $this->content_language = $var; + + return $this; + } + + /** + * Output only. The feed label for the product. + * + * Generated from protobuf field string feed_label = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFeedLabel() + { + return $this->feed_label; + } + + /** + * Output only. The feed label for the product. + * + * Generated from protobuf field string feed_label = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFeedLabel($var) + { + GPBUtil::checkString($var, True); + $this->feed_label = $var; + + return $this; + } + + /** + * Output only. A list of product attributes. + * + * Generated from protobuf field .google.shopping.css.v1.Attributes attributes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Shopping\Css\V1\Attributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * Output only. A list of product attributes. + * + * Generated from protobuf field .google.shopping.css.v1.Attributes attributes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Shopping\Css\V1\Attributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\Attributes::class); + $this->attributes = $var; + + return $this; + } + + /** + * Output only. A list of custom (CSS-provided) attributes. It can also be + * used to submit any attribute of the feed 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 additional attributes used for Buy on Google. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCustomAttributes() + { + return $this->custom_attributes; + } + + /** + * Output only. A list of custom (CSS-provided) attributes. It can also be + * used to submit any attribute of the feed 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 additional attributes used for Buy on Google. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @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 status of a product, data validation issues, that is, + * information about a product computed asynchronously. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductStatus css_product_status = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Shopping\Css\V1\CssProductStatus|null + */ + public function getCssProductStatus() + { + return $this->css_product_status; + } + + public function hasCssProductStatus() + { + return isset($this->css_product_status); + } + + public function clearCssProductStatus() + { + unset($this->css_product_status); + } + + /** + * Output only. The status of a product, data validation issues, that is, + * information about a product computed asynchronously. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductStatus css_product_status = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Shopping\Css\V1\CssProductStatus $var + * @return $this + */ + public function setCssProductStatus($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\CssProductStatus::class); + $this->css_product_status = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/CssProductInput.php b/ShoppingCss/src/V1/CssProductInput.php new file mode 100644 index 000000000000..2d42099049be --- /dev/null +++ b/ShoppingCss/src/V1/CssProductInput.php @@ -0,0 +1,455 @@ +google.shopping.css.v1.CssProductInput + */ +class CssProductInput extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the CSS Product input. + * Format: + * `accounts/{account}/cssProductInputs/{css_product_input}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The name of the processed CSS Product. + * Format: + * `accounts/{account}/cssProducts/{css_product}` + * " + * + * Generated from protobuf field string final_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $final_name = ''; + /** + * Required. Your unique identifier for the CSS Product. This is the same for + * the CSS Product input and processed CSS Product. We only allow ids with + * alphanumerics, underscores and dashes. See the [products feed + * specification](https://support.google.com/merchants/answer/188494#id) for + * details. + * + * Generated from protobuf field string raw_provided_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $raw_provided_id = ''; + /** + * Required. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS + * Product. + * + * Generated from protobuf field string content_language = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $content_language = ''; + /** + * Required. The [feed + * label](https://developers.google.com/shopping-content/guides/products/feed-labels) + * for the CSS Product. + * Feed Label is synonymous to "target country" and hence should always be a + * valid region code. For example: 'DE' for Germany, 'FR' for France. + * + * Generated from protobuf field string feed_label = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $feed_label = ''; + /** + * Represents the existing version (freshness) of the CSS Product, which + * can be used to preserve the right order when multiple updates are done at + * the same time. + * This field must not be set to the future time. + * If set, the update is prevented if a newer version of the item already + * exists in our system (that is the last update time of the existing + * CSS products is later than the freshness time set in the update). If + * the update happens, the last update time is then set to this freshness + * time. + * If not set, the update will not be prevented and the last update time will + * default to when this request was received by the CSS API. + * If the operation is prevented, the aborted exception will be + * thrown. + * + * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6; + */ + protected $freshness_time = null; + /** + * A list of CSS Product attributes. + * + * Generated from protobuf field .google.shopping.css.v1.Attributes attributes = 7; + */ + protected $attributes = null; + /** + * A list of custom (CSS-provided) attributes. It can also be used for + * submitting any attribute of the feed 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 additional attributes used for Buy on Google. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 8; + */ + private $custom_attributes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the CSS Product input. + * Format: + * `accounts/{account}/cssProductInputs/{css_product_input}` + * @type string $final_name + * Output only. The name of the processed CSS Product. + * Format: + * `accounts/{account}/cssProducts/{css_product}` + * " + * @type string $raw_provided_id + * Required. Your unique identifier for the CSS Product. This is the same for + * the CSS Product input and processed CSS Product. We only allow ids with + * alphanumerics, underscores and dashes. See the [products feed + * specification](https://support.google.com/merchants/answer/188494#id) for + * details. + * @type string $content_language + * Required. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS + * Product. + * @type string $feed_label + * Required. The [feed + * label](https://developers.google.com/shopping-content/guides/products/feed-labels) + * for the CSS Product. + * Feed Label is synonymous to "target country" and hence should always be a + * valid region code. For example: 'DE' for Germany, 'FR' for France. + * @type \Google\Protobuf\Timestamp $freshness_time + * Represents the existing version (freshness) of the CSS Product, which + * can be used to preserve the right order when multiple updates are done at + * the same time. + * This field must not be set to the future time. + * If set, the update is prevented if a newer version of the item already + * exists in our system (that is the last update time of the existing + * CSS products is later than the freshness time set in the update). If + * the update happens, the last update time is then set to this freshness + * time. + * If not set, the update will not be prevented and the last update time will + * default to when this request was received by the CSS API. + * If the operation is prevented, the aborted exception will be + * thrown. + * @type \Google\Shopping\Css\V1\Attributes $attributes + * A list of CSS Product attributes. + * @type array<\Google\Shopping\Type\CustomAttribute>|\Google\Protobuf\Internal\RepeatedField $custom_attributes + * A list of custom (CSS-provided) attributes. It can also be used for + * submitting any attribute of the feed 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 additional attributes used for Buy on Google. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductInputs::initOnce(); + parent::__construct($data); + } + + /** + * The name of the CSS Product input. + * Format: + * `accounts/{account}/cssProductInputs/{css_product_input}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the CSS Product input. + * Format: + * `accounts/{account}/cssProductInputs/{css_product_input}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The name of the processed CSS Product. + * Format: + * `accounts/{account}/cssProducts/{css_product}` + * " + * + * Generated from protobuf field string final_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getFinalName() + { + return $this->final_name; + } + + /** + * Output only. The name of the processed CSS Product. + * Format: + * `accounts/{account}/cssProducts/{css_product}` + * " + * + * Generated from protobuf field string final_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setFinalName($var) + { + GPBUtil::checkString($var, True); + $this->final_name = $var; + + return $this; + } + + /** + * Required. Your unique identifier for the CSS Product. This is the same for + * the CSS Product input and processed CSS Product. We only allow ids with + * alphanumerics, underscores and dashes. See the [products feed + * specification](https://support.google.com/merchants/answer/188494#id) for + * details. + * + * Generated from protobuf field string raw_provided_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRawProvidedId() + { + return $this->raw_provided_id; + } + + /** + * Required. Your unique identifier for the CSS Product. This is the same for + * the CSS Product input and processed CSS Product. We only allow ids with + * alphanumerics, underscores and dashes. See the [products feed + * specification](https://support.google.com/merchants/answer/188494#id) for + * details. + * + * Generated from protobuf field string raw_provided_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRawProvidedId($var) + { + GPBUtil::checkString($var, True); + $this->raw_provided_id = $var; + + return $this; + } + + /** + * Required. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS + * Product. + * + * Generated from protobuf field string content_language = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getContentLanguage() + { + return $this->content_language; + } + + /** + * Required. The two-letter [ISO + * 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS + * Product. + * + * Generated from protobuf field string content_language = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setContentLanguage($var) + { + GPBUtil::checkString($var, True); + $this->content_language = $var; + + return $this; + } + + /** + * Required. The [feed + * label](https://developers.google.com/shopping-content/guides/products/feed-labels) + * for the CSS Product. + * Feed Label is synonymous to "target country" and hence should always be a + * valid region code. For example: 'DE' for Germany, 'FR' for France. + * + * Generated from protobuf field string feed_label = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFeedLabel() + { + return $this->feed_label; + } + + /** + * Required. The [feed + * label](https://developers.google.com/shopping-content/guides/products/feed-labels) + * for the CSS Product. + * Feed Label is synonymous to "target country" and hence should always be a + * valid region code. For example: 'DE' for Germany, 'FR' for France. + * + * Generated from protobuf field string feed_label = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFeedLabel($var) + { + GPBUtil::checkString($var, True); + $this->feed_label = $var; + + return $this; + } + + /** + * Represents the existing version (freshness) of the CSS Product, which + * can be used to preserve the right order when multiple updates are done at + * the same time. + * This field must not be set to the future time. + * If set, the update is prevented if a newer version of the item already + * exists in our system (that is the last update time of the existing + * CSS products is later than the freshness time set in the update). If + * the update happens, the last update time is then set to this freshness + * time. + * If not set, the update will not be prevented and the last update time will + * default to when this request was received by the CSS API. + * If the operation is prevented, the aborted exception will be + * thrown. + * + * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getFreshnessTime() + { + return $this->freshness_time; + } + + public function hasFreshnessTime() + { + return isset($this->freshness_time); + } + + public function clearFreshnessTime() + { + unset($this->freshness_time); + } + + /** + * Represents the existing version (freshness) of the CSS Product, which + * can be used to preserve the right order when multiple updates are done at + * the same time. + * This field must not be set to the future time. + * If set, the update is prevented if a newer version of the item already + * exists in our system (that is the last update time of the existing + * CSS products is later than the freshness time set in the update). If + * the update happens, the last update time is then set to this freshness + * time. + * If not set, the update will not be prevented and the last update time will + * default to when this request was received by the CSS API. + * If the operation is prevented, the aborted exception will be + * thrown. + * + * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setFreshnessTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->freshness_time = $var; + + return $this; + } + + /** + * A list of CSS Product attributes. + * + * Generated from protobuf field .google.shopping.css.v1.Attributes attributes = 7; + * @return \Google\Shopping\Css\V1\Attributes|null + */ + public function getAttributes() + { + return $this->attributes; + } + + public function hasAttributes() + { + return isset($this->attributes); + } + + public function clearAttributes() + { + unset($this->attributes); + } + + /** + * A list of CSS Product attributes. + * + * Generated from protobuf field .google.shopping.css.v1.Attributes attributes = 7; + * @param \Google\Shopping\Css\V1\Attributes $var + * @return $this + */ + public function setAttributes($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\Attributes::class); + $this->attributes = $var; + + return $this; + } + + /** + * A list of custom (CSS-provided) attributes. It can also be used for + * submitting any attribute of the feed 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 additional attributes used for Buy on Google. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCustomAttributes() + { + return $this->custom_attributes; + } + + /** + * A list of custom (CSS-provided) attributes. It can also be used for + * submitting any attribute of the feed 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 additional attributes used for Buy on Google. + * + * Generated from protobuf field repeated .google.shopping.type.CustomAttribute custom_attributes = 8; + * @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; + } + +} + diff --git a/ShoppingCss/src/V1/CssProductStatus.php b/ShoppingCss/src/V1/CssProductStatus.php new file mode 100644 index 000000000000..dbbf6d2beb4c --- /dev/null +++ b/ShoppingCss/src/V1/CssProductStatus.php @@ -0,0 +1,246 @@ +google.shopping.css.v1.CssProductStatus + */ +class CssProductStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The intended destinations for the product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProductStatus.DestinationStatus destination_statuses = 3; + */ + private $destination_statuses; + /** + * A list of all issues associated with the product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProductStatus.ItemLevelIssue item_level_issues = 4; + */ + private $item_level_issues; + /** + * 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 creation_date = 5; + */ + protected $creation_date = null; + /** + * 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_date = 6; + */ + protected $last_update_date = null; + /** + * Date on which the item expires in Google Shopping, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp google_expiration_date = 7; + */ + protected $google_expiration_date = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Shopping\Css\V1\CssProductStatus\DestinationStatus>|\Google\Protobuf\Internal\RepeatedField $destination_statuses + * The intended destinations for the product. + * @type array<\Google\Shopping\Css\V1\CssProductStatus\ItemLevelIssue>|\Google\Protobuf\Internal\RepeatedField $item_level_issues + * A list of all issues associated with the product. + * @type \Google\Protobuf\Timestamp $creation_date + * 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_date + * Date on which the item has been last updated, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * @type \Google\Protobuf\Timestamp $google_expiration_date + * Date on which the item expires in Google Shopping, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * The intended destinations for the product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProductStatus.DestinationStatus destination_statuses = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDestinationStatuses() + { + return $this->destination_statuses; + } + + /** + * The intended destinations for the product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProductStatus.DestinationStatus destination_statuses = 3; + * @param array<\Google\Shopping\Css\V1\CssProductStatus\DestinationStatus>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDestinationStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\CssProductStatus\DestinationStatus::class); + $this->destination_statuses = $arr; + + return $this; + } + + /** + * A list of all issues associated with the product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProductStatus.ItemLevelIssue item_level_issues = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getItemLevelIssues() + { + return $this->item_level_issues; + } + + /** + * A list of all issues associated with the product. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProductStatus.ItemLevelIssue item_level_issues = 4; + * @param array<\Google\Shopping\Css\V1\CssProductStatus\ItemLevelIssue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setItemLevelIssues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\CssProductStatus\ItemLevelIssue::class); + $this->item_level_issues = $arr; + + return $this; + } + + /** + * 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 creation_date = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreationDate() + { + return $this->creation_date; + } + + public function hasCreationDate() + { + return isset($this->creation_date); + } + + public function clearCreationDate() + { + unset($this->creation_date); + } + + /** + * 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 creation_date = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreationDate($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->creation_date = $var; + + return $this; + } + + /** + * 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_date = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateDate() + { + return $this->last_update_date; + } + + public function hasLastUpdateDate() + { + return isset($this->last_update_date); + } + + public function clearLastUpdateDate() + { + unset($this->last_update_date); + } + + /** + * 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_date = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateDate($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_date = $var; + + return $this; + } + + /** + * Date on which the item expires in Google Shopping, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp google_expiration_date = 7; + * @return \Google\Protobuf\Timestamp|null + */ + public function getGoogleExpirationDate() + { + return $this->google_expiration_date; + } + + public function hasGoogleExpirationDate() + { + return isset($this->google_expiration_date); + } + + public function clearGoogleExpirationDate() + { + unset($this->google_expiration_date); + } + + /** + * Date on which the item expires in Google Shopping, in [ISO + * 8601](http://en.wikipedia.org/wiki/ISO_8601) format. + * + * Generated from protobuf field .google.protobuf.Timestamp google_expiration_date = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setGoogleExpirationDate($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->google_expiration_date = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php b/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php new file mode 100644 index 000000000000..116660eb15cb --- /dev/null +++ b/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php @@ -0,0 +1,182 @@ +google.shopping.css.v1.CssProductStatus.DestinationStatus + */ +class DestinationStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the destination + * + * Generated from protobuf field string destination = 1; + */ + protected $destination = ''; + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * approved. + * + * Generated from protobuf field repeated string approved_countries = 2; + */ + private $approved_countries; + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * pending approval. + * + * Generated from protobuf field repeated string pending_countries = 3; + */ + private $pending_countries; + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * disapproved. + * + * Generated from protobuf field repeated string disapproved_countries = 4; + */ + private $disapproved_countries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $destination + * The name of the destination + * @type array|\Google\Protobuf\Internal\RepeatedField $approved_countries + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * approved. + * @type array|\Google\Protobuf\Internal\RepeatedField $pending_countries + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * pending approval. + * @type array|\Google\Protobuf\Internal\RepeatedField $disapproved_countries + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * disapproved. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * The name of the destination + * + * Generated from protobuf field string destination = 1; + * @return string + */ + public function getDestination() + { + return $this->destination; + } + + /** + * The name of the destination + * + * Generated from protobuf field string destination = 1; + * @param string $var + * @return $this + */ + public function setDestination($var) + { + GPBUtil::checkString($var, True); + $this->destination = $var; + + return $this; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * approved. + * + * Generated from protobuf field repeated string approved_countries = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getApprovedCountries() + { + return $this->approved_countries; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * approved. + * + * Generated from protobuf field repeated string approved_countries = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setApprovedCountries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->approved_countries = $arr; + + return $this; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * pending approval. + * + * Generated from protobuf field repeated string pending_countries = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPendingCountries() + { + return $this->pending_countries; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * pending approval. + * + * Generated from protobuf field repeated string pending_countries = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPendingCountries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pending_countries = $arr; + + return $this; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * disapproved. + * + * Generated from protobuf field repeated string disapproved_countries = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDisapprovedCountries() + { + return $this->disapproved_countries; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * disapproved. + * + * Generated from protobuf field repeated string disapproved_countries = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDisapprovedCountries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->disapproved_countries = $arr; + + return $this; + } + +} + + diff --git a/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php b/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php new file mode 100644 index 000000000000..796429dd9c08 --- /dev/null +++ b/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php @@ -0,0 +1,344 @@ +google.shopping.css.v1.CssProductStatus.ItemLevelIssue + */ +class ItemLevelIssue extends \Google\Protobuf\Internal\Message +{ + /** + * The error code of the issue. + * + * Generated from protobuf field string code = 1; + */ + protected $code = ''; + /** + * How this issue affects serving of the aggregate offer. + * + * Generated from protobuf field string servability = 2; + */ + protected $servability = ''; + /** + * Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3; + */ + protected $resolution = ''; + /** + * The attribute's name, if the issue is caused by a single attribute. + * + * Generated from protobuf field string attribute = 4; + */ + protected $attribute = ''; + /** + * The destination the issue applies to. + * + * Generated from protobuf field string destination = 5; + */ + protected $destination = ''; + /** + * A short issue description in English. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * A detailed issue description in English. + * + * Generated from protobuf field string detail = 7; + */ + protected $detail = ''; + /** + * The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8; + */ + protected $documentation = ''; + /** + * List of country codes (ISO 3166-1 alpha-2) where issue applies to the + * aggregate offer. + * + * Generated from protobuf field repeated string applicable_countries = 9; + */ + private $applicable_countries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $code + * The error code of the issue. + * @type string $servability + * How this issue affects serving of the aggregate offer. + * @type string $resolution + * Whether the issue can be resolved by the merchant. + * @type string $attribute + * The attribute's name, if the issue is caused by a single attribute. + * @type string $destination + * The destination the issue applies to. + * @type string $description + * A short issue description in English. + * @type string $detail + * A detailed issue description in English. + * @type string $documentation + * The URL of a web page to help with resolving this issue. + * @type array|\Google\Protobuf\Internal\RepeatedField $applicable_countries + * List of country codes (ISO 3166-1 alpha-2) where issue applies to the + * aggregate offer. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * The error code of the issue. + * + * Generated from protobuf field string code = 1; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * The error code of the issue. + * + * Generated from protobuf field string code = 1; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + + /** + * How this issue affects serving of the aggregate offer. + * + * Generated from protobuf field string servability = 2; + * @return string + */ + public function getServability() + { + return $this->servability; + } + + /** + * How this issue affects serving of the aggregate offer. + * + * Generated from protobuf field string servability = 2; + * @param string $var + * @return $this + */ + public function setServability($var) + { + GPBUtil::checkString($var, True); + $this->servability = $var; + + return $this; + } + + /** + * Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3; + * @return string + */ + public function getResolution() + { + return $this->resolution; + } + + /** + * Whether the issue can be resolved by the merchant. + * + * Generated from protobuf field string resolution = 3; + * @param string $var + * @return $this + */ + public function setResolution($var) + { + GPBUtil::checkString($var, True); + $this->resolution = $var; + + return $this; + } + + /** + * The attribute's name, if the issue is caused by a single attribute. + * + * Generated from protobuf field string attribute = 4; + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * The attribute's name, if the issue is caused by a single attribute. + * + * Generated from protobuf field string attribute = 4; + * @param string $var + * @return $this + */ + public function setAttribute($var) + { + GPBUtil::checkString($var, True); + $this->attribute = $var; + + return $this; + } + + /** + * The destination the issue applies to. + * + * Generated from protobuf field string destination = 5; + * @return string + */ + public function getDestination() + { + return $this->destination; + } + + /** + * The destination the issue applies to. + * + * Generated from protobuf field string destination = 5; + * @param string $var + * @return $this + */ + public function setDestination($var) + { + GPBUtil::checkString($var, True); + $this->destination = $var; + + return $this; + } + + /** + * A short issue description in English. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A short issue description in English. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A detailed issue description in English. + * + * Generated from protobuf field string detail = 7; + * @return string + */ + public function getDetail() + { + return $this->detail; + } + + /** + * A detailed issue description in English. + * + * Generated from protobuf field string detail = 7; + * @param string $var + * @return $this + */ + public function setDetail($var) + { + GPBUtil::checkString($var, True); + $this->detail = $var; + + return $this; + } + + /** + * The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8; + * @return string + */ + public function getDocumentation() + { + return $this->documentation; + } + + /** + * The URL of a web page to help with resolving this issue. + * + * Generated from protobuf field string documentation = 8; + * @param string $var + * @return $this + */ + public function setDocumentation($var) + { + GPBUtil::checkString($var, True); + $this->documentation = $var; + + return $this; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where issue applies to the + * aggregate offer. + * + * Generated from protobuf field repeated string applicable_countries = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getApplicableCountries() + { + return $this->applicable_countries; + } + + /** + * List of country codes (ISO 3166-1 alpha-2) where issue applies to the + * aggregate offer. + * + * Generated from protobuf field repeated string applicable_countries = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setApplicableCountries($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->applicable_countries = $arr; + + return $this; + } + +} + + diff --git a/ShoppingCss/src/V1/DeleteAccountLabelRequest.php b/ShoppingCss/src/V1/DeleteAccountLabelRequest.php new file mode 100644 index 000000000000..4db0a47fb5af --- /dev/null +++ b/ShoppingCss/src/V1/DeleteAccountLabelRequest.php @@ -0,0 +1,86 @@ +google.shopping.css.v1.DeleteAccountLabelRequest + */ +class DeleteAccountLabelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the label to delete. + * Format: accounts/{account}/labels/{label} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the label to delete. + * Format: accounts/{account}/labels/{label} + * Please see {@see AccountLabelsServiceClient::accountLabelName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\DeleteAccountLabelRequest + * + * @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 name of the label to delete. + * Format: accounts/{account}/labels/{label} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\AccountsLabels::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the label to delete. + * Format: accounts/{account}/labels/{label} + * + * 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 name of the label to delete. + * Format: accounts/{account}/labels/{label} + * + * 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/ShoppingCss/src/V1/DeleteCssProductInputRequest.php b/ShoppingCss/src/V1/DeleteCssProductInputRequest.php new file mode 100644 index 000000000000..d9de94279165 --- /dev/null +++ b/ShoppingCss/src/V1/DeleteCssProductInputRequest.php @@ -0,0 +1,142 @@ +google.shopping.css.v1.DeleteCssProductInputRequest + */ +class DeleteCssProductInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the CSS product input resource to delete. + * Format: accounts/{account}/cssProductInputs/{css_product_input} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The Content API Supplemental Feed ID. + * The field must not be set if the action applies to a primary feed. + * If the field is set, then product action applies to a supplemental feed + * instead of primary Content API feed. + * + * Generated from protobuf field optional int64 supplemental_feed_id = 2; + */ + protected $supplemental_feed_id = null; + + /** + * @param string $name Required. The name of the CSS product input resource to delete. + * Format: accounts/{account}/cssProductInputs/{css_product_input} + * Please see {@see CssProductInputsServiceClient::cssProductInputName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\DeleteCssProductInputRequest + * + * @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 name of the CSS product input resource to delete. + * Format: accounts/{account}/cssProductInputs/{css_product_input} + * @type int|string $supplemental_feed_id + * The Content API Supplemental Feed ID. + * The field must not be set if the action applies to a primary feed. + * If the field is set, then product action applies to a supplemental feed + * instead of primary Content API feed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductInputs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the CSS product input resource to delete. + * Format: accounts/{account}/cssProductInputs/{css_product_input} + * + * 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 name of the CSS product input resource to delete. + * Format: accounts/{account}/cssProductInputs/{css_product_input} + * + * 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; + } + + /** + * The Content API Supplemental Feed ID. + * The field must not be set if the action applies to a primary feed. + * If the field is set, then product action applies to a supplemental feed + * instead of primary Content API feed. + * + * Generated from protobuf field optional int64 supplemental_feed_id = 2; + * @return int|string + */ + public function getSupplementalFeedId() + { + return isset($this->supplemental_feed_id) ? $this->supplemental_feed_id : 0; + } + + public function hasSupplementalFeedId() + { + return isset($this->supplemental_feed_id); + } + + public function clearSupplementalFeedId() + { + unset($this->supplemental_feed_id); + } + + /** + * The Content API Supplemental Feed ID. + * The field must not be set if the action applies to a primary feed. + * If the field is set, then product action applies to a supplemental feed + * instead of primary Content API feed. + * + * Generated from protobuf field optional int64 supplemental_feed_id = 2; + * @param int|string $var + * @return $this + */ + public function setSupplementalFeedId($var) + { + GPBUtil::checkInt64($var); + $this->supplemental_feed_id = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/GetAccountRequest.php b/ShoppingCss/src/V1/GetAccountRequest.php new file mode 100644 index 000000000000..40348d01dd2f --- /dev/null +++ b/ShoppingCss/src/V1/GetAccountRequest.php @@ -0,0 +1,138 @@ +google.shopping.css.v1.GetAccountRequest + */ +class GetAccountRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the managed CSS/MC account. + * Format: accounts/{account} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. Only required when retrieving MC account information. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * + * Generated from protobuf field optional string parent = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $parent = null; + + /** + * @param string $name Required. The name of the managed CSS/MC account. + * Format: accounts/{account} + * Please see {@see AccountsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\GetAccountRequest + * + * @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 name of the managed CSS/MC account. + * Format: accounts/{account} + * @type string $parent + * Optional. Only required when retrieving MC account information. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\Accounts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the managed CSS/MC account. + * Format: accounts/{account} + * + * 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 name of the managed CSS/MC account. + * Format: accounts/{account} + * + * 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; + } + + /** + * Optional. Only required when retrieving MC account information. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * + * Generated from protobuf field optional string parent = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return isset($this->parent) ? $this->parent : ''; + } + + public function hasParent() + { + return isset($this->parent); + } + + public function clearParent() + { + unset($this->parent); + } + + /** + * Optional. Only required when retrieving MC account information. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * + * Generated from protobuf field optional string parent = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/GetCssProductRequest.php b/ShoppingCss/src/V1/GetCssProductRequest.php new file mode 100644 index 000000000000..88e8cb939d11 --- /dev/null +++ b/ShoppingCss/src/V1/GetCssProductRequest.php @@ -0,0 +1,81 @@ +google.shopping.css.v1.GetCssProductRequest + */ +class GetCssProductRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the CSS product to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the CSS product to retrieve. Please see + * {@see CssProductsServiceClient::cssProductName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\GetCssProductRequest + * + * @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 name of the CSS product to retrieve. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProducts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the CSS product to retrieve. + * + * 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 name of the CSS product to retrieve. + * + * 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/ShoppingCss/src/V1/InsertCssProductInputRequest.php b/ShoppingCss/src/V1/InsertCssProductInputRequest.php new file mode 100644 index 000000000000..ef0b80ab8c83 --- /dev/null +++ b/ShoppingCss/src/V1/InsertCssProductInputRequest.php @@ -0,0 +1,165 @@ +google.shopping.css.v1.InsertCssProductInputRequest + */ +class InsertCssProductInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The account where this CSS Product will be inserted. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The CSS Product Input to insert. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductInput css_product_input = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $css_product_input = null; + /** + * Required. The primary or supplemental feed id. If CSS Product already + * exists and feed id provided is different, then the CSS Product will be + * moved to a new feed. Note: For now, CSSs do not need to provide feed ids as + * we create feeds on the fly. We do not have supplemental feed support for + * CSS Products yet. + * + * Generated from protobuf field int64 feed_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $feed_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The account where this CSS Product will be inserted. + * Format: accounts/{account} + * @type \Google\Shopping\Css\V1\CssProductInput $css_product_input + * Required. The CSS Product Input to insert. + * @type int|string $feed_id + * Required. The primary or supplemental feed id. If CSS Product already + * exists and feed id provided is different, then the CSS Product will be + * moved to a new feed. Note: For now, CSSs do not need to provide feed ids as + * we create feeds on the fly. We do not have supplemental feed support for + * CSS Products yet. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductInputs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The account where this CSS Product will be inserted. + * 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 where this CSS Product will be inserted. + * 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; + } + + /** + * Required. The CSS Product Input to insert. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductInput css_product_input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Css\V1\CssProductInput|null + */ + public function getCssProductInput() + { + return $this->css_product_input; + } + + public function hasCssProductInput() + { + return isset($this->css_product_input); + } + + public function clearCssProductInput() + { + unset($this->css_product_input); + } + + /** + * Required. The CSS Product Input to insert. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductInput css_product_input = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Css\V1\CssProductInput $var + * @return $this + */ + public function setCssProductInput($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\CssProductInput::class); + $this->css_product_input = $var; + + return $this; + } + + /** + * Required. The primary or supplemental feed id. If CSS Product already + * exists and feed id provided is different, then the CSS Product will be + * moved to a new feed. Note: For now, CSSs do not need to provide feed ids as + * we create feeds on the fly. We do not have supplemental feed support for + * CSS Products yet. + * + * Generated from protobuf field int64 feed_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int|string + */ + public function getFeedId() + { + return $this->feed_id; + } + + /** + * Required. The primary or supplemental feed id. If CSS Product already + * exists and feed id provided is different, then the CSS Product will be + * moved to a new feed. Note: For now, CSSs do not need to provide feed ids as + * we create feeds on the fly. We do not have supplemental feed support for + * CSS Products yet. + * + * Generated from protobuf field int64 feed_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int|string $var + * @return $this + */ + public function setFeedId($var) + { + GPBUtil::checkInt64($var); + $this->feed_id = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/ListAccountLabelsRequest.php b/ShoppingCss/src/V1/ListAccountLabelsRequest.php new file mode 100644 index 000000000000..6e3b7c779787 --- /dev/null +++ b/ShoppingCss/src/V1/ListAccountLabelsRequest.php @@ -0,0 +1,178 @@ +google.shopping.css.v1.ListAccountLabelsRequest + */ +class ListAccountLabelsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent account. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of labels to return. The service may return fewer than + * this value. + * If unspecified, at most 50 labels will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListAccountLabels` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccountLabels` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent account. + * Format: accounts/{account} + * Please see {@see AccountLabelsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\ListAccountLabelsRequest + * + * @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 parent account. + * Format: accounts/{account} + * @type int $page_size + * The maximum number of labels to return. The service may return fewer than + * this value. + * If unspecified, at most 50 labels will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @type string $page_token + * A page token, received from a previous `ListAccountLabels` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccountLabels` must + * match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\AccountsLabels::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent account. + * 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 parent account. + * 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; + } + + /** + * The maximum number of labels to return. The service may return fewer than + * this value. + * If unspecified, at most 50 labels will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of labels to return. The service may return fewer than + * this value. + * If unspecified, at most 50 labels will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListAccountLabels` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccountLabels` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListAccountLabels` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListAccountLabels` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/ListAccountLabelsResponse.php b/ShoppingCss/src/V1/ListAccountLabelsResponse.php new file mode 100644 index 000000000000..b9ebdc04042e --- /dev/null +++ b/ShoppingCss/src/V1/ListAccountLabelsResponse.php @@ -0,0 +1,105 @@ +google.shopping.css.v1.ListAccountLabelsResponse + */ +class ListAccountLabelsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The labels from the specified account. + * + * Generated from protobuf field repeated .google.shopping.css.v1.AccountLabel account_labels = 1; + */ + private $account_labels; + /** + * 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\Css\V1\AccountLabel>|\Google\Protobuf\Internal\RepeatedField $account_labels + * The labels from the specified account. + * @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\Css\V1\AccountsLabels::initOnce(); + parent::__construct($data); + } + + /** + * The labels from the specified account. + * + * Generated from protobuf field repeated .google.shopping.css.v1.AccountLabel account_labels = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAccountLabels() + { + return $this->account_labels; + } + + /** + * The labels from the specified account. + * + * Generated from protobuf field repeated .google.shopping.css.v1.AccountLabel account_labels = 1; + * @param array<\Google\Shopping\Css\V1\AccountLabel>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAccountLabels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\AccountLabel::class); + $this->account_labels = $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/ShoppingCss/src/V1/ListChildAccountsRequest.php b/ShoppingCss/src/V1/ListChildAccountsRequest.php new file mode 100644 index 000000000000..599677a2f8af --- /dev/null +++ b/ShoppingCss/src/V1/ListChildAccountsRequest.php @@ -0,0 +1,270 @@ +google.shopping.css.v1.ListChildAccountsRequest + */ +class ListChildAccountsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent account. Must be a CSS group or domain. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * If set, only the MC accounts with the given label ID will be returned. + * + * Generated from protobuf field optional int64 label_id = 2; + */ + protected $label_id = null; + /** + * If set, only the MC accounts with the given name (case sensitive) will be + * returned. + * + * Generated from protobuf field optional string full_name = 3; + */ + protected $full_name = null; + /** + * Optional. The maximum number of accounts to return. The service may return + * fewer than this value. If unspecified, at most 50 accounts will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListChildAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListChildAccounts` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent account. Must be a CSS group or domain. + * Format: accounts/{account} + * Please see {@see AccountsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\ListChildAccountsRequest + * + * @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 parent account. Must be a CSS group or domain. + * Format: accounts/{account} + * @type int|string $label_id + * If set, only the MC accounts with the given label ID will be returned. + * @type string $full_name + * If set, only the MC accounts with the given name (case sensitive) will be + * returned. + * @type int $page_size + * Optional. The maximum number of accounts to return. The service may return + * fewer than this value. If unspecified, at most 50 accounts will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListChildAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListChildAccounts` must + * match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\Accounts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent account. Must be a CSS group or domain. + * 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 parent account. Must be a CSS group or domain. + * 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; + } + + /** + * If set, only the MC accounts with the given label ID will be returned. + * + * Generated from protobuf field optional int64 label_id = 2; + * @return int|string + */ + public function getLabelId() + { + return isset($this->label_id) ? $this->label_id : 0; + } + + public function hasLabelId() + { + return isset($this->label_id); + } + + public function clearLabelId() + { + unset($this->label_id); + } + + /** + * If set, only the MC accounts with the given label ID will be returned. + * + * Generated from protobuf field optional int64 label_id = 2; + * @param int|string $var + * @return $this + */ + public function setLabelId($var) + { + GPBUtil::checkInt64($var); + $this->label_id = $var; + + return $this; + } + + /** + * If set, only the MC accounts with the given name (case sensitive) will be + * returned. + * + * Generated from protobuf field optional string full_name = 3; + * @return string + */ + public function getFullName() + { + return isset($this->full_name) ? $this->full_name : ''; + } + + public function hasFullName() + { + return isset($this->full_name); + } + + public function clearFullName() + { + unset($this->full_name); + } + + /** + * If set, only the MC accounts with the given name (case sensitive) will be + * returned. + * + * Generated from protobuf field optional string full_name = 3; + * @param string $var + * @return $this + */ + public function setFullName($var) + { + GPBUtil::checkString($var, True); + $this->full_name = $var; + + return $this; + } + + /** + * Optional. The maximum number of accounts to return. The service may return + * fewer than this value. If unspecified, at most 50 accounts will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of accounts to return. The service may return + * fewer than this value. If unspecified, at most 50 accounts will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * + * Generated from protobuf field int32 page_size = 4 [(.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 `ListChildAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListChildAccounts` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListChildAccounts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListChildAccounts` must + * match the call that provided the page token. + * + * Generated from protobuf field string page_token = 5 [(.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/ShoppingCss/src/V1/ListChildAccountsResponse.php b/ShoppingCss/src/V1/ListChildAccountsResponse.php new file mode 100644 index 000000000000..7f33af5e21a3 --- /dev/null +++ b/ShoppingCss/src/V1/ListChildAccountsResponse.php @@ -0,0 +1,105 @@ +google.shopping.css.v1.ListChildAccountsResponse + */ +class ListChildAccountsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The CSS/MC accounts returned for the specified CSS parent account. + * + * Generated from protobuf field repeated .google.shopping.css.v1.Account accounts = 1; + */ + private $accounts; + /** + * 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\Css\V1\Account>|\Google\Protobuf\Internal\RepeatedField $accounts + * The CSS/MC accounts returned for the specified CSS parent account. + * @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\Css\V1\Accounts::initOnce(); + parent::__construct($data); + } + + /** + * The CSS/MC accounts returned for the specified CSS parent account. + * + * Generated from protobuf field repeated .google.shopping.css.v1.Account accounts = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAccounts() + { + return $this->accounts; + } + + /** + * The CSS/MC accounts returned for the specified CSS parent account. + * + * Generated from protobuf field repeated .google.shopping.css.v1.Account accounts = 1; + * @param array<\Google\Shopping\Css\V1\Account>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAccounts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\Account::class); + $this->accounts = $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/ShoppingCss/src/V1/ListCssProductsRequest.php b/ShoppingCss/src/V1/ListCssProductsRequest.php new file mode 100644 index 000000000000..95c92a721591 --- /dev/null +++ b/ShoppingCss/src/V1/ListCssProductsRequest.php @@ -0,0 +1,178 @@ +google.shopping.css.v1.ListCssProductsRequest + */ +class ListCssProductsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The account/domain to list processed CSS Products for. + * Format: accounts/{account} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of CSS Products to return. The service may return + * fewer than this value. + * The maximum value is 1000; values above 1000 will be coerced to 1000. If + * unspecified, the maximum number of CSS products will be returned. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListCssProducts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCssProducts` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The account/domain to list processed CSS Products for. + * Format: accounts/{account} + * Please see {@see CssProductsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\ListCssProductsRequest + * + * @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/domain to list processed CSS Products for. + * Format: accounts/{account} + * @type int $page_size + * The maximum number of CSS Products to return. The service may return + * fewer than this value. + * The maximum value is 1000; values above 1000 will be coerced to 1000. If + * unspecified, the maximum number of CSS products will be returned. + * @type string $page_token + * A page token, received from a previous `ListCssProducts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCssProducts` + * must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProducts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The account/domain to list processed CSS Products 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/domain to list processed CSS Products 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; + } + + /** + * The maximum number of CSS Products to return. The service may return + * fewer than this value. + * The maximum value is 1000; values above 1000 will be coerced to 1000. If + * unspecified, the maximum number of CSS products will be returned. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of CSS Products to return. The service may return + * fewer than this value. + * The maximum value is 1000; values above 1000 will be coerced to 1000. If + * unspecified, the maximum number of CSS products will be returned. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListCssProducts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCssProducts` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListCssProducts` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListCssProducts` + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/ListCssProductsResponse.php b/ShoppingCss/src/V1/ListCssProductsResponse.php new file mode 100644 index 000000000000..578b8a690b34 --- /dev/null +++ b/ShoppingCss/src/V1/ListCssProductsResponse.php @@ -0,0 +1,109 @@ +google.shopping.css.v1.ListCssProductsResponse + */ +class ListCssProductsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The processed CSS products from the specified account. These are your + * processed CSS products after applying rules and supplemental feeds. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProduct css_products = 1; + */ + private $css_products; + /** + * 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\Css\V1\CssProduct>|\Google\Protobuf\Internal\RepeatedField $css_products + * The processed CSS products from the specified account. These are your + * processed CSS products after applying rules and supplemental feeds. + * @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\Css\V1\CssProducts::initOnce(); + parent::__construct($data); + } + + /** + * The processed CSS products from the specified account. These are your + * processed CSS products after applying rules and supplemental feeds. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProduct css_products = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCssProducts() + { + return $this->css_products; + } + + /** + * The processed CSS products from the specified account. These are your + * processed CSS products after applying rules and supplemental feeds. + * + * Generated from protobuf field repeated .google.shopping.css.v1.CssProduct css_products = 1; + * @param array<\Google\Shopping\Css\V1\CssProduct>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCssProducts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Shopping\Css\V1\CssProduct::class); + $this->css_products = $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/ShoppingCss/src/V1/ProductDetail.php b/ShoppingCss/src/V1/ProductDetail.php new file mode 100644 index 000000000000..4d462b3b8433 --- /dev/null +++ b/ShoppingCss/src/V1/ProductDetail.php @@ -0,0 +1,135 @@ +google.shopping.css.v1.ProductDetail + */ +class ProductDetail extends \Google\Protobuf\Internal\Message +{ + /** + * The section header used to group a set of product details. + * + * Generated from protobuf field string section_name = 1; + */ + protected $section_name = ''; + /** + * The name of the product detail. + * + * Generated from protobuf field string attribute_name = 2; + */ + protected $attribute_name = ''; + /** + * The value of the product detail. + * + * Generated from protobuf field string attribute_value = 3; + */ + protected $attribute_value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $section_name + * The section header used to group a set of product details. + * @type string $attribute_name + * The name of the product detail. + * @type string $attribute_value + * The value of the product detail. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * The section header used to group a set of product details. + * + * Generated from protobuf field string section_name = 1; + * @return string + */ + public function getSectionName() + { + return $this->section_name; + } + + /** + * The section header used to group a set of product details. + * + * Generated from protobuf field string section_name = 1; + * @param string $var + * @return $this + */ + public function setSectionName($var) + { + GPBUtil::checkString($var, True); + $this->section_name = $var; + + return $this; + } + + /** + * The name of the product detail. + * + * Generated from protobuf field string attribute_name = 2; + * @return string + */ + public function getAttributeName() + { + return $this->attribute_name; + } + + /** + * The name of the product detail. + * + * Generated from protobuf field string attribute_name = 2; + * @param string $var + * @return $this + */ + public function setAttributeName($var) + { + GPBUtil::checkString($var, True); + $this->attribute_name = $var; + + return $this; + } + + /** + * The value of the product detail. + * + * Generated from protobuf field string attribute_value = 3; + * @return string + */ + public function getAttributeValue() + { + return $this->attribute_value; + } + + /** + * The value of the product detail. + * + * Generated from protobuf field string attribute_value = 3; + * @param string $var + * @return $this + */ + public function setAttributeValue($var) + { + GPBUtil::checkString($var, True); + $this->attribute_value = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/ProductDimension.php b/ShoppingCss/src/V1/ProductDimension.php new file mode 100644 index 000000000000..cba0d7c47123 --- /dev/null +++ b/ShoppingCss/src/V1/ProductDimension.php @@ -0,0 +1,117 @@ +google.shopping.css.v1.ProductDimension + */ +class ProductDimension extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The dimension value represented as a number. The value can have a + * maximum precision of four decimal places. + * + * Generated from protobuf field double value = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = 0.0; + /** + * Required. The dimension units. + * Acceptable values are: + * * "`in`" + * * "`cm`" + * + * Generated from protobuf field string unit = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $unit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $value + * Required. The dimension value represented as a number. The value can have a + * maximum precision of four decimal places. + * @type string $unit + * Required. The dimension units. + * Acceptable values are: + * * "`in`" + * * "`cm`" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * Required. The dimension value represented as a number. The value can have a + * maximum precision of four decimal places. + * + * Generated from protobuf field double value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The dimension value represented as a number. The value can have a + * maximum precision of four decimal places. + * + * Generated from protobuf field double value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkDouble($var); + $this->value = $var; + + return $this; + } + + /** + * Required. The dimension units. + * Acceptable values are: + * * "`in`" + * * "`cm`" + * + * Generated from protobuf field string unit = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * Required. The dimension units. + * Acceptable values are: + * * "`in`" + * * "`cm`" + * + * Generated from protobuf field string unit = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/ProductWeight.php b/ShoppingCss/src/V1/ProductWeight.php new file mode 100644 index 000000000000..1c6212d2424c --- /dev/null +++ b/ShoppingCss/src/V1/ProductWeight.php @@ -0,0 +1,125 @@ +google.shopping.css.v1.ProductWeight + */ +class ProductWeight extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The weight represented as a number. The weight can have a maximum + * precision of four decimal places. + * + * Generated from protobuf field double value = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = 0.0; + /** + * Required. The weight unit. + * Acceptable values are: + * * "`g`" + * * "`kg`" + * * "`oz`" + * * "`lb`" + * + * Generated from protobuf field string unit = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $unit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $value + * Required. The weight represented as a number. The weight can have a maximum + * precision of four decimal places. + * @type string $unit + * Required. The weight unit. + * Acceptable values are: + * * "`g`" + * * "`kg`" + * * "`oz`" + * * "`lb`" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductCommon::initOnce(); + parent::__construct($data); + } + + /** + * Required. The weight represented as a number. The weight can have a maximum + * precision of four decimal places. + * + * Generated from protobuf field double value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The weight represented as a number. The weight can have a maximum + * precision of four decimal places. + * + * Generated from protobuf field double value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkDouble($var); + $this->value = $var; + + return $this; + } + + /** + * Required. The weight unit. + * Acceptable values are: + * * "`g`" + * * "`kg`" + * * "`oz`" + * * "`lb`" + * + * Generated from protobuf field string unit = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * Required. The weight unit. + * Acceptable values are: + * * "`g`" + * * "`kg`" + * * "`oz`" + * * "`lb`" + * + * Generated from protobuf field string unit = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/UpdateAccountLabelRequest.php b/ShoppingCss/src/V1/UpdateAccountLabelRequest.php new file mode 100644 index 000000000000..1723ee1bb579 --- /dev/null +++ b/ShoppingCss/src/V1/UpdateAccountLabelRequest.php @@ -0,0 +1,90 @@ +google.shopping.css.v1.UpdateAccountLabelRequest + */ +class UpdateAccountLabelRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The updated label. All fields must be provided. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel account_label = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $account_label = null; + + /** + * @param \Google\Shopping\Css\V1\AccountLabel $accountLabel Required. The updated label. All fields must be provided. + * + * @return \Google\Shopping\Css\V1\UpdateAccountLabelRequest + * + * @experimental + */ + public static function build(\Google\Shopping\Css\V1\AccountLabel $accountLabel): self + { + return (new self()) + ->setAccountLabel($accountLabel); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Shopping\Css\V1\AccountLabel $account_label + * Required. The updated label. All fields must be provided. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\AccountsLabels::initOnce(); + parent::__construct($data); + } + + /** + * Required. The updated label. All fields must be provided. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel account_label = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Shopping\Css\V1\AccountLabel|null + */ + public function getAccountLabel() + { + return $this->account_label; + } + + public function hasAccountLabel() + { + return isset($this->account_label); + } + + public function clearAccountLabel() + { + unset($this->account_label); + } + + /** + * Required. The updated label. All fields must be provided. + * + * Generated from protobuf field .google.shopping.css.v1.AccountLabel account_label = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Shopping\Css\V1\AccountLabel $var + * @return $this + */ + public function setAccountLabel($var) + { + GPBUtil::checkMessage($var, \Google\Shopping\Css\V1\AccountLabel::class); + $this->account_label = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/UpdateAccountLabelsRequest.php b/ShoppingCss/src/V1/UpdateAccountLabelsRequest.php new file mode 100644 index 000000000000..e692f77d1b40 --- /dev/null +++ b/ShoppingCss/src/V1/UpdateAccountLabelsRequest.php @@ -0,0 +1,176 @@ +google.shopping.css.v1.UpdateAccountLabelsRequest + */ +class UpdateAccountLabelsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The label resource name. + * Format: accounts/{account} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The list of label IDs to overwrite the existing account label IDs. + * If the list is empty, all currently assigned label IDs will be deleted. + * + * Generated from protobuf field repeated int64 label_ids = 2; + */ + private $label_ids; + /** + * Optional. Only required when updating MC account labels. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * + * Generated from protobuf field optional string parent = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $parent = null; + + /** + * @param string $name Required. The label resource name. + * Format: accounts/{account} + * Please see {@see AccountsServiceClient::accountName()} for help formatting this field. + * + * @return \Google\Shopping\Css\V1\UpdateAccountLabelsRequest + * + * @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 label resource name. + * Format: accounts/{account} + * @type array|array|\Google\Protobuf\Internal\RepeatedField $label_ids + * The list of label IDs to overwrite the existing account label IDs. + * If the list is empty, all currently assigned label IDs will be deleted. + * @type string $parent + * Optional. Only required when updating MC account labels. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\Accounts::initOnce(); + parent::__construct($data); + } + + /** + * Required. The label resource name. + * Format: accounts/{account} + * + * 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 label resource name. + * Format: accounts/{account} + * + * 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; + } + + /** + * The list of label IDs to overwrite the existing account label IDs. + * If the list is empty, all currently assigned label IDs will be deleted. + * + * Generated from protobuf field repeated int64 label_ids = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLabelIds() + { + return $this->label_ids; + } + + /** + * The list of label IDs to overwrite the existing account label IDs. + * If the list is empty, all currently assigned label IDs will be deleted. + * + * Generated from protobuf field repeated int64 label_ids = 2; + * @param array|array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLabelIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64); + $this->label_ids = $arr; + + return $this; + } + + /** + * Optional. Only required when updating MC account labels. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * + * Generated from protobuf field optional string parent = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return isset($this->parent) ? $this->parent : ''; + } + + public function hasParent() + { + return isset($this->parent); + } + + public function clearParent() + { + unset($this->parent); + } + + /** + * Optional. Only required when updating MC account labels. + * The CSS domain that is the parent resource of the MC account. + * Format: accounts/{account} + * + * Generated from protobuf field optional string parent = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/gapic_metadata.json b/ShoppingCss/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..45cb4387e68c --- /dev/null +++ b/ShoppingCss/src/V1/gapic_metadata.json @@ -0,0 +1,100 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.shopping.css.v1", + "libraryPackage": "Google\\Shopping\\Css\\V1", + "services": { + "AccountsService": { + "clients": { + "grpc": { + "libraryClient": "AccountsServiceGapicClient", + "rpcs": { + "GetAccount": { + "methods": [ + "getAccount" + ] + }, + "ListChildAccounts": { + "methods": [ + "listChildAccounts" + ] + }, + "UpdateLabels": { + "methods": [ + "updateLabels" + ] + } + } + } + } + }, + "AccountLabelsService": { + "clients": { + "grpc": { + "libraryClient": "AccountLabelsServiceGapicClient", + "rpcs": { + "CreateAccountLabel": { + "methods": [ + "createAccountLabel" + ] + }, + "DeleteAccountLabel": { + "methods": [ + "deleteAccountLabel" + ] + }, + "ListAccountLabels": { + "methods": [ + "listAccountLabels" + ] + }, + "UpdateAccountLabel": { + "methods": [ + "updateAccountLabel" + ] + } + } + } + } + }, + "CssProductInputsService": { + "clients": { + "grpc": { + "libraryClient": "CssProductInputsServiceGapicClient", + "rpcs": { + "DeleteCssProductInput": { + "methods": [ + "deleteCssProductInput" + ] + }, + "InsertCssProductInput": { + "methods": [ + "insertCssProductInput" + ] + } + } + } + } + }, + "CssProductsService": { + "clients": { + "grpc": { + "libraryClient": "CssProductsServiceGapicClient", + "rpcs": { + "GetCssProduct": { + "methods": [ + "getCssProduct" + ] + }, + "ListCssProducts": { + "methods": [ + "listCssProducts" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/ShoppingCss/src/V1/resources/account_labels_service_client_config.json b/ShoppingCss/src/V1/resources/account_labels_service_client_config.json new file mode 100644 index 000000000000..9aa209b83e97 --- /dev/null +++ b/ShoppingCss/src/V1/resources/account_labels_service_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.shopping.css.v1.AccountLabelsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [] + }, + "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 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateAccountLabel": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteAccountLabel": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListAccountLabels": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateAccountLabel": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/ShoppingCss/src/V1/resources/account_labels_service_descriptor_config.php b/ShoppingCss/src/V1/resources/account_labels_service_descriptor_config.php new file mode 100644 index 000000000000..609781bc8417 --- /dev/null +++ b/ShoppingCss/src/V1/resources/account_labels_service_descriptor_config.php @@ -0,0 +1,69 @@ + [ + 'google.shopping.css.v1.AccountLabelsService' => [ + 'CreateAccountLabel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\AccountLabel', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAccountLabel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListAccountLabels' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAccountLabels', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Shopping\Css\V1\ListAccountLabelsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAccountLabel' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\AccountLabel', + 'headerParams' => [ + [ + 'keyName' => 'account_label.name', + 'fieldAccessors' => [ + 'getAccountLabel', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + 'accountLabel' => 'accounts/{account}/labels/{label}', + ], + ], + ], +]; diff --git a/ShoppingCss/src/V1/resources/account_labels_service_rest_client_config.php b/ShoppingCss/src/V1/resources/account_labels_service_rest_client_config.php new file mode 100644 index 000000000000..cec98ff69444 --- /dev/null +++ b/ShoppingCss/src/V1/resources/account_labels_service_rest_client_config.php @@ -0,0 +1,56 @@ + [ + 'google.shopping.css.v1.AccountLabelsService' => [ + 'CreateAccountLabel' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=accounts/*}/labels', + 'body' => 'account_label', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteAccountLabel' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=accounts/*/labels/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListAccountLabels' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=accounts/*}/labels', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateAccountLabel' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{account_label.name=accounts/*/labels/*}', + 'body' => 'account_label', + 'placeholders' => [ + 'account_label.name' => [ + 'getters' => [ + 'getAccountLabel', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingCss/src/V1/resources/accounts_service_client_config.json b/ShoppingCss/src/V1/resources/accounts_service_client_config.json new file mode 100644 index 000000000000..5453c222310d --- /dev/null +++ b/ShoppingCss/src/V1/resources/accounts_service_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.shopping.css.v1.AccountsService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_codes": [] + }, + "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 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "GetAccount": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListChildAccounts": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateLabels": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/ShoppingCss/src/V1/resources/accounts_service_descriptor_config.php b/ShoppingCss/src/V1/resources/accounts_service_descriptor_config.php new file mode 100644 index 000000000000..f83b474fa6c7 --- /dev/null +++ b/ShoppingCss/src/V1/resources/accounts_service_descriptor_config.php @@ -0,0 +1,55 @@ + [ + 'google.shopping.css.v1.AccountsService' => [ + 'GetAccount' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\Account', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListChildAccounts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAccounts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Shopping\Css\V1\ListChildAccountsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateLabels' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\Account', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + ], + ], + ], +]; diff --git a/ShoppingCss/src/V1/resources/accounts_service_rest_client_config.php b/ShoppingCss/src/V1/resources/accounts_service_rest_client_config.php new file mode 100644 index 000000000000..70363ca99f5e --- /dev/null +++ b/ShoppingCss/src/V1/resources/accounts_service_rest_client_config.php @@ -0,0 +1,43 @@ + [ + 'google.shopping.css.v1.AccountsService' => [ + 'GetAccount' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=accounts/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListChildAccounts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=accounts/*}:listChildAccounts', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateLabels' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=accounts/*}:updateLabels', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingCss/src/V1/resources/css_product_inputs_service_client_config.json b/ShoppingCss/src/V1/resources/css_product_inputs_service_client_config.json new file mode 100644 index 000000000000..6bdec6d98d03 --- /dev/null +++ b/ShoppingCss/src/V1/resources/css_product_inputs_service_client_config.json @@ -0,0 +1,42 @@ +{ + "interfaces": { + "google.shopping.css.v1.CssProductInputsService": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "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 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "DeleteCssProductInput": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "InsertCssProductInput": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/ShoppingCss/src/V1/resources/css_product_inputs_service_descriptor_config.php b/ShoppingCss/src/V1/resources/css_product_inputs_service_descriptor_config.php new file mode 100644 index 000000000000..8d1383b283bc --- /dev/null +++ b/ShoppingCss/src/V1/resources/css_product_inputs_service_descriptor_config.php @@ -0,0 +1,36 @@ + [ + 'google.shopping.css.v1.CssProductInputsService' => [ + 'DeleteCssProductInput' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'InsertCssProductInput' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\CssProductInput', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + 'cssProductInput' => 'accounts/{account}/cssProductInputs/{css_product_input}', + ], + ], + ], +]; diff --git a/ShoppingCss/src/V1/resources/css_product_inputs_service_rest_client_config.php b/ShoppingCss/src/V1/resources/css_product_inputs_service_rest_client_config.php new file mode 100644 index 000000000000..4d1ba648b442 --- /dev/null +++ b/ShoppingCss/src/V1/resources/css_product_inputs_service_rest_client_config.php @@ -0,0 +1,32 @@ + [ + 'google.shopping.css.v1.CssProductInputsService' => [ + 'DeleteCssProductInput' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=accounts/*/cssProductInputs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'InsertCssProductInput' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=accounts/*}/cssProductInputs:insert', + 'body' => 'css_product_input', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingCss/src/V1/resources/css_products_service_client_config.json b/ShoppingCss/src/V1/resources/css_products_service_client_config.json new file mode 100644 index 000000000000..6e748edeed42 --- /dev/null +++ b/ShoppingCss/src/V1/resources/css_products_service_client_config.json @@ -0,0 +1,44 @@ +{ + "interfaces": { + "google.shopping.css.v1.CssProductsService": { + "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": { + "GetCssProduct": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListCssProducts": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/ShoppingCss/src/V1/resources/css_products_service_descriptor_config.php b/ShoppingCss/src/V1/resources/css_products_service_descriptor_config.php new file mode 100644 index 000000000000..5b4235cbb6d0 --- /dev/null +++ b/ShoppingCss/src/V1/resources/css_products_service_descriptor_config.php @@ -0,0 +1,44 @@ + [ + 'google.shopping.css.v1.CssProductsService' => [ + 'GetCssProduct' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\CssProduct', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListCssProducts' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getCssProducts', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Shopping\Css\V1\ListCssProductsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'templateMap' => [ + 'account' => 'accounts/{account}', + 'cssProduct' => 'accounts/{account}/cssProducts/{css_product}', + ], + ], + ], +]; diff --git a/ShoppingCss/src/V1/resources/css_products_service_rest_client_config.php b/ShoppingCss/src/V1/resources/css_products_service_rest_client_config.php new file mode 100644 index 000000000000..9c15ea052440 --- /dev/null +++ b/ShoppingCss/src/V1/resources/css_products_service_rest_client_config.php @@ -0,0 +1,31 @@ + [ + 'google.shopping.css.v1.CssProductsService' => [ + 'GetCssProduct' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=accounts/*/cssProducts/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListCssProducts' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=accounts/*}/cssProducts', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/ShoppingCss/tests/Unit/V1/Client/AccountLabelsServiceClientTest.php b/ShoppingCss/tests/Unit/V1/Client/AccountLabelsServiceClientTest.php new file mode 100644 index 000000000000..3334b68ede84 --- /dev/null +++ b/ShoppingCss/tests/Unit/V1/Client/AccountLabelsServiceClientTest.php @@ -0,0 +1,391 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AccountLabelsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AccountLabelsServiceClient($options); + } + + /** @test */ + public function createAccountLabelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $labelId = 1959256506; + $accountId = 803333011; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new AccountLabel(); + $expectedResponse->setName($name); + $expectedResponse->setLabelId($labelId); + $expectedResponse->setAccountId($accountId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $accountLabel = new AccountLabel(); + $request = (new CreateAccountLabelRequest()) + ->setParent($formattedParent) + ->setAccountLabel($accountLabel); + $response = $gapicClient->createAccountLabel($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.css.v1.AccountLabelsService/CreateAccountLabel', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAccountLabel(); + $this->assertProtobufEquals($accountLabel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createAccountLabelExceptionTest() + { + $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]'); + $accountLabel = new AccountLabel(); + $request = (new CreateAccountLabelRequest()) + ->setParent($formattedParent) + ->setAccountLabel($accountLabel); + try { + $gapicClient->createAccountLabel($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 deleteAccountLabelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->accountLabelName('[ACCOUNT]', '[LABEL]'); + $request = (new DeleteAccountLabelRequest()) + ->setName($formattedName); + $gapicClient->deleteAccountLabel($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.AccountLabelsService/DeleteAccountLabel', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAccountLabelExceptionTest() + { + $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->accountLabelName('[ACCOUNT]', '[LABEL]'); + $request = (new DeleteAccountLabelRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteAccountLabel($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 listAccountLabelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $accountLabelsElement = new AccountLabel(); + $accountLabels = [ + $accountLabelsElement, + ]; + $expectedResponse = new ListAccountLabelsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAccountLabels($accountLabels); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListAccountLabelsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAccountLabels($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAccountLabels()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.AccountLabelsService/ListAccountLabels', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAccountLabelsExceptionTest() + { + $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 ListAccountLabelsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAccountLabels($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 updateAccountLabelTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $labelId = 1959256506; + $accountId = 803333011; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new AccountLabel(); + $expectedResponse->setName($name); + $expectedResponse->setLabelId($labelId); + $expectedResponse->setAccountId($accountId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $accountLabel = new AccountLabel(); + $request = (new UpdateAccountLabelRequest()) + ->setAccountLabel($accountLabel); + $response = $gapicClient->updateAccountLabel($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.css.v1.AccountLabelsService/UpdateAccountLabel', $actualFuncCall); + $actualValue = $actualRequestObject->getAccountLabel(); + $this->assertProtobufEquals($accountLabel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateAccountLabelExceptionTest() + { + $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 + $accountLabel = new AccountLabel(); + $request = (new UpdateAccountLabelRequest()) + ->setAccountLabel($accountLabel); + try { + $gapicClient->updateAccountLabel($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 createAccountLabelAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $labelId = 1959256506; + $accountId = 803333011; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new AccountLabel(); + $expectedResponse->setName($name); + $expectedResponse->setLabelId($labelId); + $expectedResponse->setAccountId($accountId); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $accountLabel = new AccountLabel(); + $request = (new CreateAccountLabelRequest()) + ->setParent($formattedParent) + ->setAccountLabel($accountLabel); + $response = $gapicClient->createAccountLabelAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.AccountLabelsService/CreateAccountLabel', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getAccountLabel(); + $this->assertProtobufEquals($accountLabel, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/ShoppingCss/tests/Unit/V1/Client/AccountsServiceClientTest.php b/ShoppingCss/tests/Unit/V1/Client/AccountsServiceClientTest.php new file mode 100644 index 000000000000..0faa63b7ae11 --- /dev/null +++ b/ShoppingCss/tests/Unit/V1/Client/AccountsServiceClientTest.php @@ -0,0 +1,318 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AccountsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AccountsServiceClient($options); + } + + /** @test */ + public function getAccountTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $fullName = 'fullName-1677176261'; + $displayName = 'displayName1615086568'; + $homepageUri = 'homepageUri1691950491'; + $parent2 = 'parent21175163357'; + $expectedResponse = new Account(); + $expectedResponse->setName($name2); + $expectedResponse->setFullName($fullName); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setHomepageUri($homepageUri); + $expectedResponse->setParent($parent2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->accountName('[ACCOUNT]'); + $request = (new GetAccountRequest()) + ->setName($formattedName); + $response = $gapicClient->getAccount($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.css.v1.AccountsService/GetAccount', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAccountExceptionTest() + { + $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->accountName('[ACCOUNT]'); + $request = (new GetAccountRequest()) + ->setName($formattedName); + try { + $gapicClient->getAccount($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 listChildAccountsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $accountsElement = new Account(); + $accounts = [ + $accountsElement, + ]; + $expectedResponse = new ListChildAccountsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAccounts($accounts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListChildAccountsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listChildAccounts($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAccounts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.AccountsService/ListChildAccounts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listChildAccountsExceptionTest() + { + $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 ListChildAccountsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listChildAccounts($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 updateLabelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $fullName = 'fullName-1677176261'; + $displayName = 'displayName1615086568'; + $homepageUri = 'homepageUri1691950491'; + $parent2 = 'parent21175163357'; + $expectedResponse = new Account(); + $expectedResponse->setName($name2); + $expectedResponse->setFullName($fullName); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setHomepageUri($homepageUri); + $expectedResponse->setParent($parent2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->accountName('[ACCOUNT]'); + $request = (new UpdateAccountLabelsRequest()) + ->setName($formattedName); + $response = $gapicClient->updateLabels($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.css.v1.AccountsService/UpdateLabels', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateLabelsExceptionTest() + { + $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->accountName('[ACCOUNT]'); + $request = (new UpdateAccountLabelsRequest()) + ->setName($formattedName); + try { + $gapicClient->updateLabels($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 getAccountAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $fullName = 'fullName-1677176261'; + $displayName = 'displayName1615086568'; + $homepageUri = 'homepageUri1691950491'; + $parent2 = 'parent21175163357'; + $expectedResponse = new Account(); + $expectedResponse->setName($name2); + $expectedResponse->setFullName($fullName); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setHomepageUri($homepageUri); + $expectedResponse->setParent($parent2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->accountName('[ACCOUNT]'); + $request = (new GetAccountRequest()) + ->setName($formattedName); + $response = $gapicClient->getAccountAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.AccountsService/GetAccount', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php b/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php new file mode 100644 index 000000000000..2ffcd84f78d0 --- /dev/null +++ b/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php @@ -0,0 +1,247 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return CssProductInputsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new CssProductInputsServiceClient($options); + } + + /** @test */ + public function deleteCssProductInputTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cssProductInputName('[ACCOUNT]', '[CSS_PRODUCT_INPUT]'); + $request = (new DeleteCssProductInputRequest()) + ->setName($formattedName); + $gapicClient->deleteCssProductInput($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.CssProductInputsService/DeleteCssProductInput', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteCssProductInputExceptionTest() + { + $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->cssProductInputName('[ACCOUNT]', '[CSS_PRODUCT_INPUT]'); + $request = (new DeleteCssProductInputRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteCssProductInput($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 insertCssProductInputTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $finalName = 'finalName-1861489740'; + $rawProvidedId = 'rawProvidedId-845310112'; + $contentLanguage = 'contentLanguage-1408137122'; + $feedLabel = 'feedLabel574920979'; + $expectedResponse = new CssProductInput(); + $expectedResponse->setName($name); + $expectedResponse->setFinalName($finalName); + $expectedResponse->setRawProvidedId($rawProvidedId); + $expectedResponse->setContentLanguage($contentLanguage); + $expectedResponse->setFeedLabel($feedLabel); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $cssProductInput = new CssProductInput(); + $cssProductInputRawProvidedId = 'cssProductInputRawProvidedId1424807816'; + $cssProductInput->setRawProvidedId($cssProductInputRawProvidedId); + $cssProductInputContentLanguage = 'cssProductInputContentLanguage-1783585453'; + $cssProductInput->setContentLanguage($cssProductInputContentLanguage); + $cssProductInputFeedLabel = 'cssProductInputFeedLabel664498136'; + $cssProductInput->setFeedLabel($cssProductInputFeedLabel); + $feedId = 976011428; + $request = (new InsertCssProductInputRequest()) + ->setParent($formattedParent) + ->setCssProductInput($cssProductInput) + ->setFeedId($feedId); + $response = $gapicClient->insertCssProductInput($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.css.v1.CssProductInputsService/InsertCssProductInput', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getCssProductInput(); + $this->assertProtobufEquals($cssProductInput, $actualValue); + $actualValue = $actualRequestObject->getFeedId(); + $this->assertProtobufEquals($feedId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function insertCssProductInputExceptionTest() + { + $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]'); + $cssProductInput = new CssProductInput(); + $cssProductInputRawProvidedId = 'cssProductInputRawProvidedId1424807816'; + $cssProductInput->setRawProvidedId($cssProductInputRawProvidedId); + $cssProductInputContentLanguage = 'cssProductInputContentLanguage-1783585453'; + $cssProductInput->setContentLanguage($cssProductInputContentLanguage); + $cssProductInputFeedLabel = 'cssProductInputFeedLabel664498136'; + $cssProductInput->setFeedLabel($cssProductInputFeedLabel); + $feedId = 976011428; + $request = (new InsertCssProductInputRequest()) + ->setParent($formattedParent) + ->setCssProductInput($cssProductInput) + ->setFeedId($feedId); + try { + $gapicClient->insertCssProductInput($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 deleteCssProductInputAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cssProductInputName('[ACCOUNT]', '[CSS_PRODUCT_INPUT]'); + $request = (new DeleteCssProductInputRequest()) + ->setName($formattedName); + $gapicClient->deleteCssProductInputAsync($request)->wait(); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.CssProductInputsService/DeleteCssProductInput', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/ShoppingCss/tests/Unit/V1/Client/CssProductsServiceClientTest.php b/ShoppingCss/tests/Unit/V1/Client/CssProductsServiceClientTest.php new file mode 100644 index 000000000000..7558bcdfb994 --- /dev/null +++ b/ShoppingCss/tests/Unit/V1/Client/CssProductsServiceClientTest.php @@ -0,0 +1,241 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return CssProductsServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new CssProductsServiceClient($options); + } + + /** @test */ + public function getCssProductTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $rawProvidedId = 'rawProvidedId-845310112'; + $contentLanguage = 'contentLanguage-1408137122'; + $feedLabel = 'feedLabel574920979'; + $expectedResponse = new CssProduct(); + $expectedResponse->setName($name2); + $expectedResponse->setRawProvidedId($rawProvidedId); + $expectedResponse->setContentLanguage($contentLanguage); + $expectedResponse->setFeedLabel($feedLabel); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cssProductName('[ACCOUNT]', '[CSS_PRODUCT]'); + $request = (new GetCssProductRequest()) + ->setName($formattedName); + $response = $gapicClient->getCssProduct($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.css.v1.CssProductsService/GetCssProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getCssProductExceptionTest() + { + $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->cssProductName('[ACCOUNT]', '[CSS_PRODUCT]'); + $request = (new GetCssProductRequest()) + ->setName($formattedName); + try { + $gapicClient->getCssProduct($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 listCssProductsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $cssProductsElement = new CssProduct(); + $cssProducts = [ + $cssProductsElement, + ]; + $expectedResponse = new ListCssProductsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setCssProducts($cssProducts); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->accountName('[ACCOUNT]'); + $request = (new ListCssProductsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listCssProducts($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getCssProducts()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.CssProductsService/ListCssProducts', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCssProductsExceptionTest() + { + $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 ListCssProductsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listCssProducts($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 getCssProductAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $rawProvidedId = 'rawProvidedId-845310112'; + $contentLanguage = 'contentLanguage-1408137122'; + $feedLabel = 'feedLabel574920979'; + $expectedResponse = new CssProduct(); + $expectedResponse->setName($name2); + $expectedResponse->setRawProvidedId($rawProvidedId); + $expectedResponse->setContentLanguage($contentLanguage); + $expectedResponse->setFeedLabel($feedLabel); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->cssProductName('[ACCOUNT]', '[CSS_PRODUCT]'); + $request = (new GetCssProductRequest()) + ->setName($formattedName); + $response = $gapicClient->getCssProductAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.shopping.css.v1.CssProductsService/GetCssProduct', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/ShoppingMerchantInventories/composer.json b/ShoppingMerchantInventories/composer.json index 2ec03a204435..50f31b24dd05 100644 --- a/ShoppingMerchantInventories/composer.json +++ b/ShoppingMerchantInventories/composer.json @@ -19,7 +19,7 @@ "require": { "php": ">=7.4", "google/gax": "^1.24.0", - "google/shopping-common-protos": "^0.1.0" + "google/shopping-common-protos": "^0.2.0" }, "require-dev": { "phpunit/phpunit": "^9.0" diff --git a/ShoppingMerchantReports/composer.json b/ShoppingMerchantReports/composer.json index 9592610ca922..9f9d7c3d57d5 100644 --- a/ShoppingMerchantReports/composer.json +++ b/ShoppingMerchantReports/composer.json @@ -19,7 +19,7 @@ "require": { "php": ">=7.4", "google/gax": "^1.24.0", - "google/shopping-common-protos": "^0.1.0" + "google/shopping-common-protos": "^0.2.0" }, "require-dev": { "phpunit/phpunit": "^9.0" diff --git a/composer.json b/composer.json index 47f877414ec0..9ff2a66f804e 100644 --- a/composer.json +++ b/composer.json @@ -233,6 +233,7 @@ "google/grafeas": "0.8.3", "google/longrunning": "0.2.6", "google/shopping-common-protos": "0.2.0", + "google/shopping-css": "0.0.0", "google/shopping-merchant-inventories": "0.1.1", "google/shopping-merchant-reports": "0.4.0" }, @@ -408,6 +409,7 @@ "GPBMetadata\\Google\\Privacy\\Dlp\\": "Dlp/metadata", "GPBMetadata\\Google\\Pubsub\\": "PubSub/metadata", "GPBMetadata\\Google\\Rpc\\": "CommonProtos/metadata/Rpc", + "GPBMetadata\\Google\\Shopping\\Css\\": "ShoppingCss/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Inventories\\": "ShoppingMerchantInventories/metadata", "GPBMetadata\\Google\\Shopping\\Merchant\\Reports\\": "ShoppingMerchantReports/metadata", "GPBMetadata\\Google\\Shopping\\Type\\": "ShoppingCommonProtos/metadata/Type", @@ -583,6 +585,7 @@ "Google\\Cloud\\Workflows\\": "Workflows/src", "Google\\Identity\\AccessContextManager\\": "AccessContextManager/src", "Google\\LongRunning\\": "LongRunning/src/LongRunning", + "Google\\Shopping\\Css\\": "ShoppingCss/src", "Google\\Shopping\\Merchant\\Inventories\\": "ShoppingMerchantInventories/src", "Google\\Shopping\\Merchant\\Reports\\": "ShoppingMerchantReports/src", "Google\\Shopping\\Type\\": "ShoppingCommonProtos/src/Type",