Skip to content

Commit

Permalink
feat: UpdateCssProduct is added to CssProductInput proto (#7961)
Browse files Browse the repository at this point in the history
docs: Mark `freshness_time` as deprecated
docs : Mark `feed_id` as deprecated
docs: A comment for field `page_size` in message `.google.shopping.css.v1.ListChildAccountsRequest` is changed
docs: A comment for field `low_price` in message `.google.shopping.css.v1.Attributes` is changed
docs: A comment for field `high_price` in message `.google.shopping.css.v1.Attributes` is changed
docs: A comment for field `number_of_offers` in message `.google.shopping.css.v1.Attributes` is changed
docs: A comment for field `headline_offer_price` in message `.google.shopping.css.v1.Attributes` is changed
docs: A comment for field `headline_offer_shipping_price` in message `.google.shopping.css.v1.Attributes` is changed
docs: A comment for field `approved_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed
docs: A comment for field `pending_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed
docs: A comment for field `disapproved_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed
docs: A comment for field `servability` in message `.google.shopping.css.v1.CssProductStatus` is changed
docs: A comment for field `applicable_countries` in message `.google.shopping.css.v1.CssProductStatus` is changed
docs: A comment for field `feed_id` in message`.google.shopping.css.v1.InsertCssProductInputRequest` is changed
docs: A comment for message `CssProduct` is changed
PiperOrigin-RevId: 708397816
Source-Link: googleapis/googleapis@892e72f
Source-Link: googleapis/googleapis-gen@09992f0
Copy-Tag: eyJwIjoiU2hvcHBpbmdDc3MvLk93bEJvdC55YW1sIiwiaCI6IjA5OTkyZjBkOTQ1YmViMDkyMTIyZmExYmRmNDUzZjUzMjFiYzBmOGMifQ==
  • Loading branch information
gcf-owl-bot[bot] authored Dec 23, 2024
1 parent f21a8f4 commit 305c0e8
Show file tree
Hide file tree
Showing 17 changed files with 553 additions and 95 deletions.
Binary file modified ShoppingCss/metadata/V1/CssProductInputs.php
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 {
Expand All @@ -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]
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://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.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START css_v1_generated_CssProductInputsService_UpdateCssProductInput_sync]
use Google\ApiCore\ApiException;
use Google\Shopping\Css\V1\Client\CssProductInputsServiceClient;
use Google\Shopping\Css\V1\CssProductInput;
use Google\Shopping\Css\V1\UpdateCssProductInputRequest;

/**
* 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.
*
* @param string $cssProductInputRawProvidedId 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.
* @param string $cssProductInputContentLanguage The two-letter [ISO
* 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the CSS
* Product.
* @param string $cssProductInputFeedLabel 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.
*/
function update_css_product_input_sample(
string $cssProductInputRawProvidedId,
string $cssProductInputContentLanguage,
string $cssProductInputFeedLabel
): void {
// Create a client.
$cssProductInputsServiceClient = new CssProductInputsServiceClient();

// Prepare the request message.
$cssProductInput = (new CssProductInput())
->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]
40 changes: 20 additions & 20 deletions ShoppingCss/src/V1/Attributes.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions ShoppingCss/src/V1/Client/CssProductInputsServiceClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -52,6 +53,7 @@
*
* @method PromiseInterface<void> deleteCssProductInputAsync(DeleteCssProductInputRequest $request, array $optionalArgs = [])
* @method PromiseInterface<CssProductInput> insertCssProductInputAsync(InsertCssProductInputRequest $request, array $optionalArgs = [])
* @method PromiseInterface<CssProductInput> updateCssProductInputAsync(UpdateCssProductInputRequest $request, array $optionalArgs = [])
*/
final class CssProductInputsServiceClient
{
Expand Down Expand Up @@ -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();
}
}
2 changes: 1 addition & 1 deletion ShoppingCss/src/V1/CssProduct.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 305c0e8

Please sign in to comment.