diff --git a/ShoppingCss/metadata/V1/CssProductInputs.php b/ShoppingCss/metadata/V1/CssProductInputs.php index 78c0cea0c985..1d4588af8512 100644 Binary files a/ShoppingCss/metadata/V1/CssProductInputs.php and b/ShoppingCss/metadata/V1/CssProductInputs.php differ diff --git a/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php b/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php index 7a1417df00ba..c3d3ecd64aa9 100644 --- a/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php +++ b/ShoppingCss/samples/V1/CssProductInputsServiceClient/insert_css_product_input.php @@ -52,18 +52,12 @@ * 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. - * @param int $feedId 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. */ function insert_css_product_input_sample( string $formattedParent, string $cssProductInputRawProvidedId, string $cssProductInputContentLanguage, - string $cssProductInputFeedLabel, - int $feedId + string $cssProductInputFeedLabel ): void { // Create a client. $cssProductInputsServiceClient = new CssProductInputsServiceClient(); @@ -75,8 +69,7 @@ function insert_css_product_input_sample( ->setFeedLabel($cssProductInputFeedLabel); $request = (new InsertCssProductInputRequest()) ->setParent($formattedParent) - ->setCssProductInput($cssProductInput) - ->setFeedId($feedId); + ->setCssProductInput($cssProductInput); // Call the API and handle any network failures. try { @@ -103,14 +96,12 @@ function callSample(): void $cssProductInputRawProvidedId = '[RAW_PROVIDED_ID]'; $cssProductInputContentLanguage = '[CONTENT_LANGUAGE]'; $cssProductInputFeedLabel = '[FEED_LABEL]'; - $feedId = 0; insert_css_product_input_sample( $formattedParent, $cssProductInputRawProvidedId, $cssProductInputContentLanguage, - $cssProductInputFeedLabel, - $feedId + $cssProductInputFeedLabel ); } // [END css_v1_generated_CssProductInputsService_InsertCssProductInput_sync] diff --git a/ShoppingCss/samples/V1/CssProductInputsServiceClient/update_css_product_input.php b/ShoppingCss/samples/V1/CssProductInputsServiceClient/update_css_product_input.php new file mode 100644 index 000000000000..e7ab93940b2a --- /dev/null +++ b/ShoppingCss/samples/V1/CssProductInputsServiceClient/update_css_product_input.php @@ -0,0 +1,98 @@ +setRawProvidedId($cssProductInputRawProvidedId) + ->setContentLanguage($cssProductInputContentLanguage) + ->setFeedLabel($cssProductInputFeedLabel); + $request = (new UpdateCssProductInputRequest()) + ->setCssProductInput($cssProductInput); + + // Call the API and handle any network failures. + try { + /** @var CssProductInput $response */ + $response = $cssProductInputsServiceClient->updateCssProductInput($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 +{ + $cssProductInputRawProvidedId = '[RAW_PROVIDED_ID]'; + $cssProductInputContentLanguage = '[CONTENT_LANGUAGE]'; + $cssProductInputFeedLabel = '[FEED_LABEL]'; + + update_css_product_input_sample( + $cssProductInputRawProvidedId, + $cssProductInputContentLanguage, + $cssProductInputFeedLabel + ); +} +// [END css_v1_generated_CssProductInputsService_UpdateCssProductInput_sync] diff --git a/ShoppingCss/src/V1/Attributes.php b/ShoppingCss/src/V1/Attributes.php index ba23e29101e1..d69034664ba2 100644 --- a/ShoppingCss/src/V1/Attributes.php +++ b/ShoppingCss/src/V1/Attributes.php @@ -35,19 +35,19 @@ class Attributes extends \Google\Protobuf\Internal\Message */ protected $cpp_ads_redirect = null; /** - * Low Price of the aggregate offer. + * Low Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price low_price = 3; */ protected $low_price = null; /** - * High Price of the aggregate offer. + * High Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price high_price = 4; */ protected $high_price = null; /** - * The number of aggregate offers. + * The number of CSS Products. * * Generated from protobuf field optional int64 number_of_offers = 5; */ @@ -59,7 +59,7 @@ class Attributes extends \Google\Protobuf\Internal\Message */ protected $headline_offer_condition = null; /** - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price headline_offer_price = 7; */ @@ -77,7 +77,7 @@ class Attributes extends \Google\Protobuf\Internal\Message */ protected $headline_offer_mobile_link = null; /** - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price headline_offer_shipping_price = 41; */ @@ -363,21 +363,21 @@ class Attributes extends \Google\Protobuf\Internal\Message * 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. + * Low Price of the CSS Product. * @type \Google\Shopping\Type\Price $high_price - * High Price of the aggregate offer. + * High Price of the CSS Product. * @type int|string $number_of_offers - * The number of aggregate offers. + * The number of CSS Products. * @type string $headline_offer_condition * Condition of the headline offer. * @type \Google\Shopping\Type\Price $headline_offer_price - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * @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. + * Headline Price of the CSS Product. * @type string $title * Title of the item. * @type string $image_link @@ -606,7 +606,7 @@ public function setCppAdsRedirect($var) } /** - * Low Price of the aggregate offer. + * Low Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price low_price = 3; * @return \Google\Shopping\Type\Price|null @@ -627,7 +627,7 @@ public function clearLowPrice() } /** - * Low Price of the aggregate offer. + * Low Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price low_price = 3; * @param \Google\Shopping\Type\Price $var @@ -642,7 +642,7 @@ public function setLowPrice($var) } /** - * High Price of the aggregate offer. + * High Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price high_price = 4; * @return \Google\Shopping\Type\Price|null @@ -663,7 +663,7 @@ public function clearHighPrice() } /** - * High Price of the aggregate offer. + * High Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price high_price = 4; * @param \Google\Shopping\Type\Price $var @@ -678,7 +678,7 @@ public function setHighPrice($var) } /** - * The number of aggregate offers. + * The number of CSS Products. * * Generated from protobuf field optional int64 number_of_offers = 5; * @return int|string @@ -699,7 +699,7 @@ public function clearNumberOfOffers() } /** - * The number of aggregate offers. + * The number of CSS Products. * * Generated from protobuf field optional int64 number_of_offers = 5; * @param int|string $var @@ -750,7 +750,7 @@ public function setHeadlineOfferCondition($var) } /** - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price headline_offer_price = 7; * @return \Google\Shopping\Type\Price|null @@ -771,7 +771,7 @@ public function clearHeadlineOfferPrice() } /** - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price headline_offer_price = 7; * @param \Google\Shopping\Type\Price $var @@ -858,7 +858,7 @@ public function setHeadlineOfferMobileLink($var) } /** - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price headline_offer_shipping_price = 41; * @return \Google\Shopping\Type\Price|null @@ -879,7 +879,7 @@ public function clearHeadlineOfferShippingPrice() } /** - * Headline Price of the aggregate offer. + * Headline Price of the CSS Product. * * Generated from protobuf field .google.shopping.type.Price headline_offer_shipping_price = 41; * @param \Google\Shopping\Type\Price $var diff --git a/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php b/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php index 85c6dff42010..830d20d896a2 100644 --- a/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php +++ b/ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php @@ -35,6 +35,7 @@ use Google\Shopping\Css\V1\CssProductInput; use Google\Shopping\Css\V1\DeleteCssProductInputRequest; use Google\Shopping\Css\V1\InsertCssProductInputRequest; +use Google\Shopping\Css\V1\UpdateCssProductInputRequest; use GuzzleHttp\Promise\PromiseInterface; use Psr\Log\LoggerInterface; @@ -52,6 +53,7 @@ * * @method PromiseInterface deleteCssProductInputAsync(DeleteCssProductInputRequest $request, array $optionalArgs = []) * @method PromiseInterface insertCssProductInputAsync(InsertCssProductInputRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateCssProductInputAsync(UpdateCssProductInputRequest $request, array $optionalArgs = []) */ final class CssProductInputsServiceClient { @@ -292,4 +294,36 @@ public function insertCssProductInput( ): CssProductInput { return $this->startApiCall('InsertCssProductInput', $request, $callOptions)->wait(); } + + /** + * Updates the existing Css Product input in your CSS Center account. + * + * 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::updateCssProductInputAsync()} . + * + * @example samples/V1/CssProductInputsServiceClient/update_css_product_input.php + * + * @param UpdateCssProductInputRequest $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 updateCssProductInput( + UpdateCssProductInputRequest $request, + array $callOptions = [] + ): CssProductInput { + return $this->startApiCall('UpdateCssProductInput', $request, $callOptions)->wait(); + } } diff --git a/ShoppingCss/src/V1/CssProduct.php b/ShoppingCss/src/V1/CssProduct.php index 768f8e9b3bdb..e306ab48c27d 100644 --- a/ShoppingCss/src/V1/CssProduct.php +++ b/ShoppingCss/src/V1/CssProduct.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * The processed CSS Product(a.k.a Aggregate Offer internally). + * The processed CSS Product. * * Generated from protobuf message google.shopping.css.v1.CssProduct */ diff --git a/ShoppingCss/src/V1/CssProductInput.php b/ShoppingCss/src/V1/CssProductInput.php index 2d42099049be..c126325e78c8 100644 --- a/ShoppingCss/src/V1/CssProductInput.php +++ b/ShoppingCss/src/V1/CssProductInput.php @@ -63,6 +63,7 @@ class CssProductInput extends \Google\Protobuf\Internal\Message */ protected $feed_label = ''; /** + * DEPRECATED. Use expiration_date instead. * 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. @@ -77,7 +78,8 @@ class CssProductInput extends \Google\Protobuf\Internal\Message * If the operation is prevented, the aborted exception will be * thrown. * - * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6; + * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6 [deprecated = true]; + * @deprecated */ protected $freshness_time = null; /** @@ -130,6 +132,7 @@ class CssProductInput extends \Google\Protobuf\Internal\Message * 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 + * DEPRECATED. Use expiration_date instead. * 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. @@ -320,6 +323,7 @@ public function setFeedLabel($var) } /** + * DEPRECATED. Use expiration_date instead. * 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. @@ -334,25 +338,30 @@ public function setFeedLabel($var) * If the operation is prevented, the aborted exception will be * thrown. * - * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6; + * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6 [deprecated = true]; * @return \Google\Protobuf\Timestamp|null + * @deprecated */ public function getFreshnessTime() { + @trigger_error('freshness_time is deprecated.', E_USER_DEPRECATED); return $this->freshness_time; } public function hasFreshnessTime() { + @trigger_error('freshness_time is deprecated.', E_USER_DEPRECATED); return isset($this->freshness_time); } public function clearFreshnessTime() { + @trigger_error('freshness_time is deprecated.', E_USER_DEPRECATED); unset($this->freshness_time); } /** + * DEPRECATED. Use expiration_date instead. * 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. @@ -367,12 +376,14 @@ public function clearFreshnessTime() * If the operation is prevented, the aborted exception will be * thrown. * - * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6; + * Generated from protobuf field .google.protobuf.Timestamp freshness_time = 6 [deprecated = true]; * @param \Google\Protobuf\Timestamp $var * @return $this + * @deprecated */ public function setFreshnessTime($var) { + @trigger_error('freshness_time is deprecated.', E_USER_DEPRECATED); GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); $this->freshness_time = $var; diff --git a/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php b/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php index 116660eb15cb..256a200a139e 100644 --- a/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php +++ b/ShoppingCss/src/V1/CssProductStatus/DestinationStatus.php @@ -22,21 +22,21 @@ class DestinationStatus extends \Google\Protobuf\Internal\Message */ protected $destination = ''; /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product 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 + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product 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 + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * disapproved. * * Generated from protobuf field repeated string disapproved_countries = 4; @@ -52,13 +52,13 @@ class DestinationStatus extends \Google\Protobuf\Internal\Message * @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 + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * approved. * @type array|\Google\Protobuf\Internal\RepeatedField $pending_countries - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product 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 + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * disapproved. * } */ @@ -94,7 +94,7 @@ public function setDestination($var) } /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * approved. * * Generated from protobuf field repeated string approved_countries = 2; @@ -106,7 +106,7 @@ public function getApprovedCountries() } /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * approved. * * Generated from protobuf field repeated string approved_countries = 2; @@ -122,7 +122,7 @@ public function setApprovedCountries($var) } /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * pending approval. * * Generated from protobuf field repeated string pending_countries = 3; @@ -134,7 +134,7 @@ public function getPendingCountries() } /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * pending approval. * * Generated from protobuf field repeated string pending_countries = 3; @@ -150,7 +150,7 @@ public function setPendingCountries($var) } /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * disapproved. * * Generated from protobuf field repeated string disapproved_countries = 4; @@ -162,7 +162,7 @@ public function getDisapprovedCountries() } /** - * List of country codes (ISO 3166-1 alpha-2) where the aggregate offer is + * List of country codes (ISO 3166-1 alpha-2) where the CSS Product is * disapproved. * * Generated from protobuf field repeated string disapproved_countries = 4; diff --git a/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php b/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php index 796429dd9c08..2035fce16ef6 100644 --- a/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php +++ b/ShoppingCss/src/V1/CssProductStatus/ItemLevelIssue.php @@ -22,7 +22,7 @@ class ItemLevelIssue extends \Google\Protobuf\Internal\Message */ protected $code = ''; /** - * How this issue affects serving of the aggregate offer. + * How this issue affects serving of the CSS Product. * * Generated from protobuf field string servability = 2; */ @@ -65,7 +65,7 @@ class ItemLevelIssue extends \Google\Protobuf\Internal\Message protected $documentation = ''; /** * List of country codes (ISO 3166-1 alpha-2) where issue applies to the - * aggregate offer. + * CSS Product. * * Generated from protobuf field repeated string applicable_countries = 9; */ @@ -80,7 +80,7 @@ class ItemLevelIssue extends \Google\Protobuf\Internal\Message * @type string $code * The error code of the issue. * @type string $servability - * How this issue affects serving of the aggregate offer. + * How this issue affects serving of the CSS Product. * @type string $resolution * Whether the issue can be resolved by the merchant. * @type string $attribute @@ -95,7 +95,7 @@ class ItemLevelIssue extends \Google\Protobuf\Internal\Message * 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. + * CSS Product. * } */ public function __construct($data = NULL) { @@ -130,7 +130,7 @@ public function setCode($var) } /** - * How this issue affects serving of the aggregate offer. + * How this issue affects serving of the CSS Product. * * Generated from protobuf field string servability = 2; * @return string @@ -141,7 +141,7 @@ public function getServability() } /** - * How this issue affects serving of the aggregate offer. + * How this issue affects serving of the CSS Product. * * Generated from protobuf field string servability = 2; * @param string $var @@ -313,7 +313,7 @@ public function setDocumentation($var) /** * List of country codes (ISO 3166-1 alpha-2) where issue applies to the - * aggregate offer. + * CSS Product. * * Generated from protobuf field repeated string applicable_countries = 9; * @return \Google\Protobuf\Internal\RepeatedField @@ -325,7 +325,7 @@ public function getApplicableCountries() /** * List of country codes (ISO 3166-1 alpha-2) where issue applies to the - * aggregate offer. + * CSS Product. * * Generated from protobuf field repeated string applicable_countries = 9; * @param array|\Google\Protobuf\Internal\RepeatedField $var diff --git a/ShoppingCss/src/V1/InsertCssProductInputRequest.php b/ShoppingCss/src/V1/InsertCssProductInputRequest.php index ef0b80ab8c83..4f8736fbb505 100644 --- a/ShoppingCss/src/V1/InsertCssProductInputRequest.php +++ b/ShoppingCss/src/V1/InsertCssProductInputRequest.php @@ -29,13 +29,16 @@ class InsertCssProductInputRequest extends \Google\Protobuf\Internal\Message */ 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. + * Optional. DEPRECATED. Feed id is not required for CSS Products. + * 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]; + * Generated from protobuf field int64 feed_id = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated */ protected $feed_id = 0; @@ -51,11 +54,13 @@ class InsertCssProductInputRequest extends \Google\Protobuf\Internal\Message * @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. + * Optional. DEPRECATED. Feed id is not required for CSS Products. + * 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) { @@ -128,33 +133,41 @@ public function setCssProductInput($var) } /** - * 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. + * Optional. DEPRECATED. Feed id is not required for CSS Products. + * 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]; + * Generated from protobuf field int64 feed_id = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * @return int|string + * @deprecated */ public function getFeedId() { + @trigger_error('feed_id is deprecated.', E_USER_DEPRECATED); 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. + * Optional. DEPRECATED. Feed id is not required for CSS Products. + * 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]; + * Generated from protobuf field int64 feed_id = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; * @param int|string $var * @return $this + * @deprecated */ public function setFeedId($var) { + @trigger_error('feed_id is deprecated.', E_USER_DEPRECATED); GPBUtil::checkInt64($var); $this->feed_id = $var; diff --git a/ShoppingCss/src/V1/ListChildAccountsRequest.php b/ShoppingCss/src/V1/ListChildAccountsRequest.php index 599677a2f8af..bfe12bf0c32d 100644 --- a/ShoppingCss/src/V1/ListChildAccountsRequest.php +++ b/ShoppingCss/src/V1/ListChildAccountsRequest.php @@ -38,8 +38,8 @@ class ListChildAccountsRequest extends \Google\Protobuf\Internal\Message /** * 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. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; */ @@ -86,8 +86,8 @@ public static function build(string $parent): self * @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. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * @type string $page_token * Optional. A page token, received from a previous `ListChildAccounts` call. * Provide this to retrieve the subsequent page. @@ -205,8 +205,8 @@ public function setFullName($var) /** * 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. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; * @return int @@ -219,8 +219,8 @@ public function getPageSize() /** * 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. + * returned. The maximum value is 100; values above 100 will be coerced to + * 100. * * Generated from protobuf field int32 page_size = 4 [(.google.api.field_behavior) = OPTIONAL]; * @param int $var diff --git a/ShoppingCss/src/V1/UpdateCssProductInputRequest.php b/ShoppingCss/src/V1/UpdateCssProductInputRequest.php new file mode 100644 index 000000000000..e962dcd2d01d --- /dev/null +++ b/ShoppingCss/src/V1/UpdateCssProductInputRequest.php @@ -0,0 +1,196 @@ +google.shopping.css.v1.UpdateCssProductInputRequest + */ +class UpdateCssProductInputRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The CSS product input resource to update. Information you submit + * will be applied to the processed CSS product as well. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductInput css_product_input = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $css_product_input = null; + /** + * The list of CSS product attributes to be updated. + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * Providing special "*" value for full CSS product replacement is not + * supported. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Shopping\Css\V1\CssProductInput $cssProductInput Required. The CSS product input resource to update. Information you submit + * will be applied to the processed CSS product as well. + * @param \Google\Protobuf\FieldMask $updateMask The list of CSS product attributes to be updated. + * + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * + * Providing special "*" value for full CSS product replacement is not + * supported. + * + * @return \Google\Shopping\Css\V1\UpdateCssProductInputRequest + * + * @experimental + */ + public static function build(\Google\Shopping\Css\V1\CssProductInput $cssProductInput, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setCssProductInput($cssProductInput) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Shopping\Css\V1\CssProductInput $css_product_input + * Required. The CSS product input resource to update. Information you submit + * will be applied to the processed CSS product as well. + * @type \Google\Protobuf\FieldMask $update_mask + * The list of CSS product attributes to be updated. + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * Providing special "*" value for full CSS product replacement is not + * supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Shopping\Css\V1\CssProductInputs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The CSS product input resource to update. Information you submit + * will be applied to the processed CSS product as well. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductInput css_product_input = 1 [(.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 resource to update. Information you submit + * will be applied to the processed CSS product as well. + * + * Generated from protobuf field .google.shopping.css.v1.CssProductInput css_product_input = 1 [(.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; + } + + /** + * The list of CSS product attributes to be updated. + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * Providing special "*" value for full CSS product replacement is not + * supported. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The list of CSS product attributes to be updated. + * If the update mask is omitted, then it is treated as implied field mask + * equivalent to all fields that are populated (have a non-empty value). + * Attributes specified in the update mask without a value specified in the + * body will be deleted from the CSS product. + * Update mask can only be specified for top level fields in + * attributes and custom attributes. + * To specify the update mask for custom attributes you need to add the + * `custom_attribute.` prefix. + * Providing special "*" value for full CSS product replacement is not + * supported. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/ShoppingCss/src/V1/gapic_metadata.json b/ShoppingCss/src/V1/gapic_metadata.json index 45cb4387e68c..c45ea2ba629f 100644 --- a/ShoppingCss/src/V1/gapic_metadata.json +++ b/ShoppingCss/src/V1/gapic_metadata.json @@ -72,6 +72,11 @@ "methods": [ "insertCssProductInput" ] + }, + "UpdateCssProductInput": { + "methods": [ + "updateCssProductInput" + ] } } } 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 index 6bdec6d98d03..ebd7bf51d23e 100644 --- a/ShoppingCss/src/V1/resources/css_product_inputs_service_client_config.json +++ b/ShoppingCss/src/V1/resources/css_product_inputs_service_client_config.json @@ -35,6 +35,11 @@ "timeout_millis": 60000, "retry_codes_name": "no_retry_1_codes", "retry_params_name": "no_retry_1_params" + }, + "UpdateCssProductInput": { + "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 index 3d28d4be2ea9..6ba97dc190eb 100644 --- a/ShoppingCss/src/V1/resources/css_product_inputs_service_descriptor_config.php +++ b/ShoppingCss/src/V1/resources/css_product_inputs_service_descriptor_config.php @@ -47,6 +47,19 @@ ], ], ], + 'UpdateCssProductInput' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Shopping\Css\V1\CssProductInput', + 'headerParams' => [ + [ + 'keyName' => 'css_product_input.name', + 'fieldAccessors' => [ + 'getCssProductInput', + 'getName', + ], + ], + ], + ], '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 index d3af676e3935..3bc542dcae97 100644 --- 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 @@ -46,6 +46,19 @@ ], ], ], + 'UpdateCssProductInput' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{css_product_input.name=accounts/*/cssProductInputs/*}', + 'body' => 'css_product_input', + 'placeholders' => [ + 'css_product_input.name' => [ + 'getters' => [ + 'getCssProductInput', + 'getName', + ], + ], + ], + ], ], ], 'numericEnums' => true, diff --git a/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php b/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php index 2ffcd84f78d0..b1b4666fa08a 100644 --- a/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php +++ b/ShoppingCss/tests/Unit/V1/Client/CssProductInputsServiceClientTest.php @@ -32,6 +32,7 @@ use Google\Shopping\Css\V1\CssProductInput; use Google\Shopping\Css\V1\DeleteCssProductInputRequest; use Google\Shopping\Css\V1\InsertCssProductInputRequest; +use Google\Shopping\Css\V1\UpdateCssProductInputRequest; use stdClass; /** @@ -153,11 +154,9 @@ public function insertCssProductInputTest() $cssProductInput->setContentLanguage($cssProductInputContentLanguage); $cssProductInputFeedLabel = 'cssProductInputFeedLabel664498136'; $cssProductInput->setFeedLabel($cssProductInputFeedLabel); - $feedId = 976011428; $request = (new InsertCssProductInputRequest()) ->setParent($formattedParent) - ->setCssProductInput($cssProductInput) - ->setFeedId($feedId); + ->setCssProductInput($cssProductInput); $response = $gapicClient->insertCssProductInput($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -169,8 +168,6 @@ public function insertCssProductInputTest() $this->assertProtobufEquals($formattedParent, $actualValue); $actualValue = $actualRequestObject->getCssProductInput(); $this->assertProtobufEquals($cssProductInput, $actualValue); - $actualValue = $actualRequestObject->getFeedId(); - $this->assertProtobufEquals($feedId, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -201,11 +198,9 @@ public function insertCssProductInputExceptionTest() $cssProductInput->setContentLanguage($cssProductInputContentLanguage); $cssProductInputFeedLabel = 'cssProductInputFeedLabel664498136'; $cssProductInput->setFeedLabel($cssProductInputFeedLabel); - $feedId = 976011428; $request = (new InsertCssProductInputRequest()) ->setParent($formattedParent) - ->setCssProductInput($cssProductInput) - ->setFeedId($feedId); + ->setCssProductInput($cssProductInput); try { $gapicClient->insertCssProductInput($request); // If the $gapicClient method call did not throw, fail the test @@ -219,6 +214,90 @@ public function insertCssProductInputExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function updateCssProductInputTest() + { + $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 + $cssProductInput = new CssProductInput(); + $cssProductInputRawProvidedId = 'cssProductInputRawProvidedId1424807816'; + $cssProductInput->setRawProvidedId($cssProductInputRawProvidedId); + $cssProductInputContentLanguage = 'cssProductInputContentLanguage-1783585453'; + $cssProductInput->setContentLanguage($cssProductInputContentLanguage); + $cssProductInputFeedLabel = 'cssProductInputFeedLabel664498136'; + $cssProductInput->setFeedLabel($cssProductInputFeedLabel); + $request = (new UpdateCssProductInputRequest()) + ->setCssProductInput($cssProductInput); + $response = $gapicClient->updateCssProductInput($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/UpdateCssProductInput', $actualFuncCall); + $actualValue = $actualRequestObject->getCssProductInput(); + $this->assertProtobufEquals($cssProductInput, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateCssProductInputExceptionTest() + { + $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 + $cssProductInput = new CssProductInput(); + $cssProductInputRawProvidedId = 'cssProductInputRawProvidedId1424807816'; + $cssProductInput->setRawProvidedId($cssProductInputRawProvidedId); + $cssProductInputContentLanguage = 'cssProductInputContentLanguage-1783585453'; + $cssProductInput->setContentLanguage($cssProductInputContentLanguage); + $cssProductInputFeedLabel = 'cssProductInputFeedLabel664498136'; + $cssProductInput->setFeedLabel($cssProductInputFeedLabel); + $request = (new UpdateCssProductInputRequest()) + ->setCssProductInput($cssProductInput); + try { + $gapicClient->updateCssProductInput($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() {