-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add product purge API feat: add page_categories to control condition feat: support attribute suggestion in autocomplete feat: support frequent bought together model config feat: allow to skip denylist postfiltering in recommendations chore: deprecate recent search result in autocomplete docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 641043920 Source-Link: googleapis/googleapis@7660854 Source-Link: googleapis/googleapis-gen@f62c255 Copy-Tag: eyJwIjoiUmV0YWlsLy5Pd2xCb3QueWFtbCIsImgiOiJmNjJjMjU1NWFmYzc3ZGQyNmRiMDIxNmM3YWIwODdiZTcxY2E2YmZjIn0=
- Loading branch information
1 parent
9b419c4
commit c5ea1f3
Showing
63 changed files
with
3,414 additions
and
465 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
Retail/samples/V2/ProductServiceClient/purge_products.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<?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 retail_v2_generated_ProductService_PurgeProducts_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\Retail\V2\Client\ProductServiceClient; | ||
use Google\Cloud\Retail\V2\PurgeProductsRequest; | ||
use Google\Cloud\Retail\V2\PurgeProductsResponse; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Permanently deletes all selected [Product][google.cloud.retail.v2.Product]s | ||
* under a branch. | ||
* | ||
* This process is asynchronous. If the request is valid, the removal will be | ||
* enqueued and processed offline. Depending on the number of | ||
* [Product][google.cloud.retail.v2.Product]s, this operation could take hours | ||
* to complete. Before the operation completes, some | ||
* [Product][google.cloud.retail.v2.Product]s may still be returned by | ||
* [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] | ||
* or | ||
* [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. | ||
* | ||
* Depending on the number of [Product][google.cloud.retail.v2.Product]s, this | ||
* operation could take hours to complete. To get a sample of | ||
* [Product][google.cloud.retail.v2.Product]s that would be deleted, set | ||
* [PurgeProductsRequest.force][google.cloud.retail.v2.PurgeProductsRequest.force] | ||
* to false. | ||
* | ||
* @param string $formattedParent The resource name of the branch under which the products are | ||
* created. The format is | ||
* `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` | ||
* Please see {@see ProductServiceClient::branchName()} for help formatting this field. | ||
* @param string $filter The filter string to specify the products to be deleted with a | ||
* length limit of 5,000 characters. | ||
* | ||
* Empty string filter is not allowed. "*" implies delete all items in a | ||
* branch. | ||
* | ||
* The eligible fields for filtering are: | ||
* | ||
* * `availability`: Double quoted | ||
* [Product.availability][google.cloud.retail.v2.Product.availability] string. | ||
* * `create_time` : in ISO 8601 "zulu" format. | ||
* | ||
* Supported syntax: | ||
* | ||
* * Comparators (">", "<", ">=", "<=", "="). | ||
* Examples: | ||
* * create_time <= "2015-02-13T17:05:46Z" | ||
* * availability = "IN_STOCK" | ||
* | ||
* * Conjunctions ("AND") | ||
* Examples: | ||
* * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" | ||
* | ||
* * Disjunctions ("OR") | ||
* Examples: | ||
* * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" | ||
* | ||
* * Can support nested queries. | ||
* Examples: | ||
* * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") | ||
* OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") | ||
* | ||
* * Filter Limits: | ||
* * Filter should not contain more than 6 conditions. | ||
* * Max nesting depth should not exceed 2 levels. | ||
* | ||
* Examples queries: | ||
* * Delete back order products created before a timestamp. | ||
* create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" | ||
*/ | ||
function purge_products_sample(string $formattedParent, string $filter): void | ||
{ | ||
// Create a client. | ||
$productServiceClient = new ProductServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new PurgeProductsRequest()) | ||
->setParent($formattedParent) | ||
->setFilter($filter); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $productServiceClient->purgeProducts($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
/** @var PurgeProductsResponse $result */ | ||
$result = $response->getResult(); | ||
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); | ||
} else { | ||
/** @var Status $error */ | ||
$error = $response->getError(); | ||
printf('Operation failed with error data: %s' . PHP_EOL, $error->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 = ProductServiceClient::branchName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[CATALOG]', | ||
'[BRANCH]' | ||
); | ||
$filter = '[FILTER]'; | ||
|
||
purge_products_sample($formattedParent, $filter); | ||
} | ||
// [END retail_v2_generated_ProductService_PurgeProducts_sync] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.